Skip to content

Instantly share code, notes, and snippets.

@Ozsie
Last active January 8, 2018 19:04
Show Gist options
  • Save Ozsie/b454ab22ee9ce168b1119dc1b15578f0 to your computer and use it in GitHub Desktop.
Save Ozsie/b454ab22ee9ce168b1119dc1b15578f0 to your computer and use it in GitHub Desktop.
Load EEPROM
#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