Skip to content

Instantly share code, notes, and snippets.

@igrr
igrr / mem_usage.sh
Last active Jun 3, 2016
Get memory usage from elf file (esp8266 toolchain, using linker script from SDK)
View mem_usage.sh
#!/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 Jan 6, 2015
PubSubClient sample for ESP8266 Arduino
View esp8266_pubsubclient.ino
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
const char* ssid = ".................";
const char* password = "................";
char* topic = "esp8266_arduino_out";
char* server = "iot.eclipse.org";
View webserver_sample_2.ino
#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 Jun 11, 2015
ESP8266 Arduino OTA example v1
View OTATest.ino
#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 Jun 11, 2015
ESP8266 Arduino OTA test script
View ota_server.py
#!/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
View HTTPServo.ino
#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 Oct 6, 2015
Custom ESP8266WebServer RequestHandler sample
View AboutPage.h
#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 Oct 7, 2015
Sketch for K30 Sensor connected to ESP8266 over serial
View K30SensorSerial.ino
#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 Oct 28, 2015
Updates to the esp8266/arduino repository
View arduino-filter.sh
#!/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 Jun 8, 2021
ESP8266 ota over HTTPS
View ESP8266httpsUpdate.ino
/*
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.
*/