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
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
// 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
#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
typedef struct { | |
uint32_t _salt; | |
uint16_t volt; | |
int16_t data1; | |
int16_t data2; | |
uint8_t devid; | |
} data; | |
data sensor_data; |
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" | |
} | |
char* topic = "wifitest"; | |
int test_para = 5000; |
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 "HX711.h" | |
// HX711.DOUT - pin #A1 | |
// HX711.PD_SCK - pin #A0 | |
HX711 scale(4, 5, 128); // parameter "gain" is ommited; the default value 128 is used by the library | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("HX711 Demo"); |
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 requestEvent() | |
{ | |
if ( m % 2 == 0 ) { | |
I2C_writeAnything(sensor_data); | |
} else { | |
I2C_writeAnything(sensor_data_copy); | |
} | |
m++; | |
} |
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
// CPU 80MHZ, FLASH 4M/1M | |
/* | |
*** Sample using esp-01, D16 is connected to RST | |
*** If DHT22 is powered by a gpio( VCC of DHT22 is connected to a gpio) and OUTPUT of DHT22 is connected to D2, boot will fail. | |
*** Power off ----> D2 is in LOW( == DHT22 is in LOW) ==> SDIO boot mode. | |
Temperature and humidity values are each read out the results of the last measurement. | |
For real-time data that need continuous read twice, we recommend repeatedly to read sensors, | |
and each read sensor interval is greater than 2 seconds to obtain accuratethe data. |
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> | |
#include "PietteTech_DHT.h" | |
// ap setting | |
#include "/usr/local/src/ap_setting.h" | |
extern "C" { | |
#include "user_interface.h" | |
} |