Skip to content

Instantly share code, notes, and snippets.

View chaeplin's full-sized avatar

chaeplin chaeplin

View GitHub Profile
@chaeplin
chaeplin / syslog.ino
Created February 2, 2016 16:15
syslog.ino
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#define _IS_MY_HOME
// wifi
#ifdef _IS_MY_HOME
#include "/usr/local/src/ap_setting.h"
#else
#include "ap_setting.h"
#endif
@chaeplin
chaeplin / lowreal.net_rtc_mem.ino
Last active February 1, 2016 08:14
lowreal.net_rtc_mem.ino
// from http://lowreal.net/2016/01/10/1
#include <Arduino.h>
extern "C" {
#include <user_interface.h>
};
// system_rtc_mem_write() 先のブロックアドレス。
// 4 bytes で align されており、先頭256bytes はシステム予約領域
// 64 から書けるはずだが、65 以降でないとうまくいかなかった。。
static const uint32_t USER_DATA_ADDR = 66;
@chaeplin
chaeplin / callback.ino
Last active January 29, 2016 14:50
callback.ino
void callback(char* topic, byte* payload, unsigned int length) {
String receivedtopic = topic;
String receivedpayload ;
for (int i = 0; i < length; i++) {
receivedpayload += (char)payload[i];
}
@chaeplin
chaeplin / esp8266_fpm_mdem_sleep.ino
Created January 26, 2016 11:39
esp8266_fpm_mdem_sleep.ino
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include "/usr/local/src/ap_setting.h"
extern "C" {
#include "user_interface.h"
}
#define FPM_SLEEP_MAX_TIME 0xFFFFFFF
@chaeplin
chaeplin / esp8266_rtc_mem_test.ino
Last active March 17, 2017 22:51
esp8266_rtc_mem_test.ino
/*
system_rtc_mem_write
Function:
During deep sleep, only RTC still working, so maybe we need to save some user data in RTC memory.
Only user data area can be used by user.
|<--------system data--------->|<-----------------user data--------------->|
| 256 bytes | 512 bytes |
Note:
RTC memory is 4 bytes aligned for read and write operations. Parameter des_addr means block number(4 bytes per block).
@chaeplin
chaeplin / mqtt-tls.ino
Last active January 10, 2022 01:59
mqtt-tls.ino
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include "/usr/local/src/ap_setting.h"
#define DEBUG_PRINT 1
@chaeplin
chaeplin / WPA2 -EAP-TLS.ino
Last active January 6, 2022 13:50
WPA2 -EAP-TLS.ino
/*
WPA2-ENT EAP-TLS
based on joostd's code : https://github.com/joostd/esp8266-eduroam
https://github.com/joostd/esp8266-eduroam/blob/master/gen_cert.sh
wifi_station_set_cert_key
Function: Set certificate and private key for connecting to WPA2-ENTERPRISE AP.
Note:
• Connecting to WPA2-ENTERPRISE AP needs more than 26 KB memory, please ensure enough space (system_get_free_heap_size).
@chaeplin
chaeplin / ESP8266 Code (RX node)
Created December 18, 2015 00:27 — forked from crcastle/ESP8266 Code (RX node)
Trying to use NRF24L01+ on ESP8266, using the ESP8266 as MCU (i.e. not an Arduino or ATmega328). See https://github.com/esp8266/Arduino for details on initial setup of ESP8266 as Arduino-compatible MCU. The serial output below does not show expected messages: a) the full output shows up all at once then stops dead and b) the values for _salt, vo…
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define DEVICE_ID 2
#define CHANNEL 1 //MAX 127
RF24 radio(15, 15); // Set up nRF24L01 radio on SPI bus plus pins 7 & 8
// Topology
const uint64_t pipes[2] = { 0xFFFFFFFFFFLL, 0xCCCCCCCCCCLL };
@chaeplin
chaeplin / receiver.ino
Created December 14, 2015 03:17 — forked from rlogiacco/receiver.ino
nRF24 multiple transmitters
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int senderId;
// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
//Contacts from the radio to connect NRF24L01 pinamnam -> Arduino
@chaeplin
chaeplin / Serial.test.ino
Created December 1, 2015 19:27
Serial.test
int testpin1 = 5;
void setup() {
pinMode(testpin1, OUTPUT);
}
void loop() {
Serial.begin(115200);
digitalWrite(testpin1, LOW);
delay(2000);