Skip to content

Instantly share code, notes, and snippets.

@igrr
igrr / mem_usage.sh
Last active June 3, 2016 16:39
Get memory usage from elf file (esp8266 toolchain, using linker script from SDK)
#!/bin/bash
# Print data, rodata, bss sizes in bytes
#
# Usage:
# OBJDUMP=../xtensa-lx106-elf/bin/xtensa-lx106-elf-objdump ./mem_usage.sh app.out [total_mem_size]
#
# If you specify total_mem_size, free heap size will also be printed
# For esp8266, total_mem_size is 81920
#
@igrr
igrr / esp8266_pubsubclient.ino
Created January 6, 2015 23:44
PubSubClient sample for ESP8266 Arduino
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
const char* ssid = ".................";
const char* password = "................";
char* topic = "esp8266_arduino_out";
char* server = "iot.eclipse.org";
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* ssid = "..............";
const char* password = "................";
String form = "<form action='led'><input type='radio' name='state' value='1' checked>On<input type='radio' name='state' value='0'>Off<input type='submit' value='Submit'></form>";
String imagepage = "<img src='/led.png'>";
@igrr
igrr / OTATest.ino
Created June 11, 2015 15:24
ESP8266 Arduino OTA example v1
#include <ESP8266WiFi.h>
#include <WiFiUDP.h>
const char* ssid = "..........";
const char* password = "...........";
WiFiUDP listener;
void setup() {
Serial.begin(115200);
@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
#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 / 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)
{
@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 / 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 / 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.
*/