Reprap/Quick thermistor hack

aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Version vom 19. November 2007, 20:04 Uhr von Bre (Diskussion | Beiträge) (in real: Phantasus, just forgot my password)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springenZur Suche springen

int pwm_c = 11; int thermistorpin=0; float fraction=0; int i;

void setup() { pinMode(pwm_c, OUTPUT);

       Serial.begin(9600);

}

/* my first time on the arduino, the damn thing doesnt work, the calculation is dumb simple, but I must admit, that I'm too stupid to get the error solved */

/* it should sets the motor due to the value of the thermistor, but the thermistor produces (for me: Phantasus) weird values, which produce a result of 100% */

void loop() {

   int therm;	
   therm=analogRead(thermistorpin)-238;
   Serial.println("Thermistor value:");
   Serial.println(therm, DEC);
     fraction = (therm/750)*255;
   analogWrite(pwm_c,(int)fraction);	
   Serial.println("Result");
   Serial.println(fraction,DEC);    

}