

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


#include #include #define ONE_WIRE_BUS 13 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); String password = "1234"; bool ok = false; void setup() { Serial.begin(9600); sensors.begin(); Serial.println("Enter Password:"); } void loop() { if (Serial.available()) { String input = Serial.readStringUntil('\n'); input.trim(); // removes \r, spaces ok = (input == password); if (ok) Serial.println("ACCESS GRANTED ✔"); else Serial.println("WRONG PASSWORD "); } if (ok) { sensors.requestTemperatures(); Serial.print("Temp: "); Serial.println(sensors.getTempCByIndex(0)); delay(2000); } }