Skip to content

Instantly share code, notes, and snippets.

View Ozsie's full-sized avatar

Oscar Djupfeldt Ozsie

  • Abilia
  • Gothenburg, Sweden
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ozsie on github.
  • I am ozsie (https://keybase.io/ozsie) on keybase.
  • I have a public key ASCWFMLeG3ccWW4K51uZTsReWCKTjvEkpmRl0aeeJIsA6Qo

To claim this, I am signing this object:

@Ozsie
Ozsie / temp1.ino
Created January 8, 2018 09:36
Empty sketch
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
@Ozsie
Ozsie / temp2.ino
Created January 8, 2018 09:40
Simple setup
void setup() {
Serial.begin(115200);
Serial.println("Hello World");
}
void loop() {
}
@Ozsie
Ozsie / temp3.ino
Last active January 8, 2018 09:48
Read temperature
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2 // DS18B20 pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
void setup() {
Serial.begin(115200);
Serial.println("Hello World");
@Ozsie
Ozsie / wifitemp.h
Last active January 8, 2018 11:55
Wifi thermometer header
#ifndef WIFI_TEMP
#define WIFI_TEMP
#include <OneWire.h>
#include <DallasTemperature.h>
#include <EEPROM.h>
#define ONE_WIRE_BUS 2 // DS18B20 pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
@Ozsie
Ozsie / storageEeprom.ino
Last active January 8, 2018 12:05
EEPROM storage
#include "wifitemp.h"
void storeEeprom() {
EEPROM.begin(eepromSize);
EEPROM.put(0, conf);
char ok[2+1] = "OK";
EEPROM.put(0+sizeof(conf), ok);
bool commited = EEPROM.commit();
EEPROM.end();
Serial.print("Commit result: ");
@Ozsie
Ozsie / temp4.ino
Last active January 8, 2018 19:04
Load EEPROM
#include "wifitemp.h"
bool isConfigured() {
return (strlen(conf.wifiPassword) != 0 && strlen(conf.wifiSsid));
}
void setup() {
Serial.begin(115200);
Serial.println("Hello World");
@Ozsie
Ozsie / wifitemp.h
Last active January 8, 2018 19:19
WiFi AP header
#ifndef WIFI_TEMP
#define WIFI_TEMP
#include <ESP8266WebServer.h>
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <EEPROM.h>
ESP8266WebServer server(80);
@Ozsie
Ozsie / setup.ino
Last active January 8, 2018 19:25
Configuration server
#include "wifitemp.h"
void setupServer() {
delay(1000);
Serial.println();
Serial.print("Configuring access point...");
const char *ssid = "wifi-temp";
const char *password = "wifi-temp";
@Ozsie
Ozsie / wifitemp.ino
Last active January 8, 2018 20:12
Almost there
#include "wifitemp.h"
bool isConfigured() {
return (strlen(conf.wifiPassword) != 0 && strlen(conf.wifiSsid));
}
void setup() {
Serial.begin(115200);
Serial.println("Hello World");