Reprap/Quick thermistor hack: Unterschied zwischen den Versionen
aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springenPk (Diskussion | Beiträge) K (hat Quick thermistor hack nach Reprap/Quick thermistor hack verschoben) |
Pk (Diskussion | Beiträge) K (+cat.) |
||
Zeile 29: | Zeile 29: | ||
Serial.println(fraction,DEC); | Serial.println(fraction,DEC); | ||
} | } | ||
+ | |||
+ | |||
+ | [[Category:Reprep]] |
Version vom 20. November 2007, 12:07 Uhr
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*255)/750); analogWrite(pwm_c,(int)fraction); Serial.println("Result"); Serial.println(fraction,DEC); }