Stap 2: Voeg de code toe
#include
#include int tempPin = A0; int geleid = 13; float temp; float settemp; int swtu = 7; int swtd = 6; LiquidCrystal lcd (12, 11, 5, 4, 3, 2); void setup {pinMode (led, 1); Serial.begin (9600); LCD.begin (16, 2); lcd.setCursor (0, 0); LCD.Print ("hello, world!"); LCD.Clear(); EEPROM.read (1); }
void loop {int tvalue = analogRead(tempPin); zweven temp = (tvalue / 6.388888888889); lcd.setCursor (0, 0), lcd.print (temp); lcd.print ('F'); Serial.println (temp); settemp = EEPROM.read(1); vertraging (250); Als (digitalRead(swtu) == 1) {settemp ++;} else {} als (digitalRead (swtd) == 1) {(settemp--);} else {} als (temp > settemp) {digitalWrite (led, 1);} else {digitalWrite (led, 0);} lcd.setCursor (0, 1); 4 lcd.print ('ingesteld op'); LCD.Print (settemp); LCD.Print ('F'); Serial.println(settemp); EEPROM.write (1, settemp); vertraging (250); }