Skip to content

Instantly share code, notes, and snippets.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
uint8_t buff[128] = { 0 };
void setup() {
WiFi.mode(WIFI_STA);
WiFi.begin("#!/bin/test", "test_bin");
Serial.begin(115200);
#include <functional>
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("");
Serial.println("start");
}
uint32_t measure_time(std::function<void(void)> fn)
@igrr
igrr / ESP8266_K30_DHT.ino
Created December 25, 2015 12:56
ESP8266 + K-30 CO2 Sensor over UART + DHT22 temperature/humidity sensor + MQTT
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <DHT.h>
DHT dht(D5, DHT22);
const char* ssid = "........";
const char* password = "........";
IPAddress mqttServer(192, 168, 1, 10);
@igrr
igrr / mh-z14.ino
Created December 25, 2015 11:42
MH-Z14 ESP8266 Arduino example
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <time.h>
const char* ssid = "co2_sensor";
const char* password = "1qazxsw2";
ESP8266WebServer server(80);
@igrr
igrr / ESP8266httpsUpdate.ino
Last active October 30, 2022 14:18
ESP8266 ota over HTTPS
/*
OTA update over HTTPS
As an example, we download and install ESP8266Basic firmware from github.
Requires latest git version of the core (November 17, 2015)
Created by Ivan Grokhotkov, 2015.
This example is in public domain.
*/
@igrr
igrr / arduino-filter.sh
Created October 28, 2015 10:50
Updates to the esp8266/arduino repository
#!/bin/bash
set -e
# get a fresh copy
git clone arduino arduino-new
cd arduino-new
git remote remove origin
# untie our commmits from master IDE branch
echo "a12c6fcea253a987e2b83aca2d9f717d0d201472" > .git/info/grafts
@igrr
igrr / K30SensorSerial.ino
Created October 7, 2015 13:08
Sketch for K30 Sensor connected to ESP8266 over serial
#include <ESP8266WiFi.h>
const char* ssid = ".........";
const char* password = ".........";
const char* host = "api.thingspeak.com";
void setup() {
delay(1000);
@igrr
igrr / AboutPage.h
Created October 6, 2015 12:29
Custom ESP8266WebServer RequestHandler sample
#ifndef ABOUT_PAGE_H
#define ABOUT_PAGE_H
#include <ESP8266WebServer.h>
class AboutPage : public RequestHandler {
public:
AboutPage(const char* uri = "about")
: _uri(uri)
{
#include <Servo.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* ssid = "your-ssid";
const char* pass = "your-password";
ESP8266WebServer server(80);
Servo myservo;
@igrr
igrr / ota_server.py
Created June 11, 2015 15:31
ESP8266 Arduino OTA test script
#!/usr/bin/python
#
# this script will push an OTA update to the ESP
#
# use it like: python ota_server.py <ESP_IP_address> <sketch.bin>
#
# on the ESP side you need code like this: https://gist.github.com/igrr/43d5c52328e955bb6b09 to handle the update
#
import socket