Skip to content

Instantly share code, notes, and snippets.

@igrr
igrr / format.sh
Created Nov 3, 2016
(temporary) ESP-IDF style guide
View format.sh
#!/bin/bash
# Runs astyle with the full set of formatting options
astyle \
--style=otbs \
--indent=spaces=4 \
--convert-tabs \
--align-pointer=name \
--align-reference=name \
--keep-one-line-statements \
--pad-header \
@igrr
igrr / newlib-esp32-configure.sh
Last active Jan 31, 2017
These are the steps to build newlib used in ESP32 ROM and ESP-IDF
View newlib-esp32-configure.sh
git clone https://github.com/espressif/newlib-esp32.git &&
cd newlib-esp32 && \
./configure \
--with-newlib \
--enable-multilib \
--disable-newlib-io-c99-formats \
--disable-newlib-supplied-syscalls \
--enable-newlib-nano-formatted-io \
--enable-newlib-reent-small \
--enable-target-optspace \
@igrr
igrr / SMTP_ESP8266.ino
Created Jun 23, 2016
ESP8266 Arduino SMTPClient test
View SMTP_ESP8266.ino
// Download SMTPClient library from https://github.com/gregington/SMTPClient
#include <ESP8266WiFi.h>
#include <Client.h>
#include <Mail.h>
#include <SMTPClient.h>
WiFiClient wifiClient;
SmtpClient client(&wifiClient, "smtp.163.com");
View WiFiConfigTest.ino
#include <ESP8266WiFi.h>
#include <FS.h>
#include <ESP8266WebServer.h>
void startSoftAP() {
Serial.println("startSoftAP");
WiFi.mode(WIFI_AP);
WiFi.softAP("ESPAP");
ESP8266WebServer server;
View GetEETimes.ino
#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);
View MicrosTimingTest.ino
#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 Dec 25, 2015
ESP8266 + K-30 CO2 Sensor over UART + DHT22 temperature/humidity sensor + MQTT
View ESP8266_K30_DHT.ino
#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 Dec 25, 2015
MH-Z14 ESP8266 Arduino example
View mh-z14.ino
#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 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.
*/
@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