Last active
January 8, 2018 19:04
-
-
Save Ozsie/b454ab22ee9ce168b1119dc1b15578f0 to your computer and use it in GitHub Desktop.
Load EEPROM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "wifitemp.h" | |
bool isConfigured() { | |
return (strlen(conf.wifiPassword) != 0 && strlen(conf.wifiSsid)); | |
} | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("Hello World"); | |
Serial.println(""); | |
Serial.print("EEPROM size required: "); | |
Serial.println(0+sizeof(conf)+sizeof("OK")); | |
pinMode(14, INPUT); | |
int state = digitalRead(14); | |
if (state == LOW) { | |
Serial.print("Pin 14 is LOW, resetting EEPROM"); | |
storeEeprom(); | |
} | |
loadEeprom(); | |
if (!isConfigured()) { | |
Serial.println("No configuration"); | |
} | |
} | |
void loop() { | |
int temp; | |
do { | |
DS18B20.requestTemperatures(); | |
temp = DS18B20.getTempCByIndex(0); | |
Serial.print("Temperature: "); | |
Serial.println(temp); | |
delay(100); | |
} while ((temp > 80.0 || temp == (-127.0))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment