This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int testpin1 = 5; | |
void setup() { | |
pinMode(testpin1, OUTPUT); | |
} | |
void loop() { | |
Serial.begin(115200); | |
digitalWrite(testpin1, LOW); | |
delay(2000); |