Skip to content

Instantly share code, notes, and snippets.

#include <NeoPixelBus.h> // NeoPixelAnimator branch
#define pixelCount 7 // Strip has 30 NeoPixels
#define pixelPin 2 // Strip is attached to GPIO2 on ESP-01
NeoPixelBus strip = NeoPixelBus(pixelCount, pixelPin);
void setup() {
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <FS.h>
const char * ssid = "...";
const char * pass = "...";
const char * remotehost_git = "raw.githubusercontent.com";
const char * path_git = "/sticilface/ESPmanager/Strings/examples/Settingsmanager-example/data";
Connected to raw.githubusercontent.com
pos:0 pos:3 pos:6 pos:9 pos:12 pos:15 pos:18 pos:21 pos:24 pos:27 pos:30 pos:33 pos:36 pos:39 pos:42 pos:45 pos:48 pos:51 pos:54 pos:57 certificate matches
please start sntp first !
:wr
:sent 245
:ww
---- HEADER ---
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
const char* ssid = "...";
const char* password = "...";
WiFiClientSecure * pclient;
void setup() {
@sticilface
sticilface / Bufferedpackets.h
Last active November 26, 2015 11:59
Send buffered packets from print to either ESP8266WebServer or WiFiClient on ESP8266
/*
Send out buffered packets to ESP8266WebServer or WiFiClient on ESP8266 on Arduino IDE.
See https://github.com/bblanchon/ArduinoJson/issues/166
exmaple of use with arudino json
size_t jsonlength = root.measureLength();
HTTP.setContentLength(jsonlength);
HTTP.send(200, "text/json" );
BufferedPrint<HTTP_DOWNLOAD_UNIT_SIZE> proxy(HTTP);
root.printTo(proxy);
@sticilface
sticilface / SPIFFShelper.h
Created November 26, 2015 12:12
Use SPIFFS like EEPROM
struct spiffs_helper_t {
File f;
spiffs_helper_t(const char * _path ) {
f = SPIFFS.open(_path, "r+"); // try to open if there... for read and write
if (!f) {
f = SPIFFS.open(_path, "w+"); // if fail open for read/write but new
}
};
@sticilface
sticilface / servestaticrootfix.ino
Created November 26, 2015 18:03
Example sketch serving a static directory where / does not find /index.htm
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <FS.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
const char* ssid = "xxx";
const char* password = "xxx";
@sticilface
sticilface / SPIFFSfile length issue
Last active November 27, 2015 11:02
demonstrates the file length issue
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <FS.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
const char* ssid = "xxx";
const char* password = "xxx";
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include <FS.h>
File configFile;
bool config_read() {
DynamicJsonBuffer jsonBuffer;
@sticilface
sticilface / ESP_asyncJSON.ino
Last active January 26, 2016 13:05
demonstrates crash with large JSONs
/*
*
* Demonstrates crash using chuncked print and large Json
* Requires
* https://github.com/me-no-dev/ESPAsyncWebServer
* https://github.com/me-no-dev/ESPAsyncTCP
* https://github.com/bblanchon/ArduinoJson
*
* use curl to make request...
* http://ip/json -> Will make request and send results async... causes crash. Works if lines are removed from json.. see addJson function