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 springen
K (+cat.)
KKeine Bearbeitungszusammenfassung
Zeile 31: Zeile 31:




[[Category:Reprep]]
[[Category:Reprap]]

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);    
}