Commit 9106b665 authored by PhiBo's avatar PhiBo 🚀

Controll ESP8266 Module

parent e78d9065
......@@ -9,8 +9,11 @@
#define RPC_NUM_HANDLERS 20
#define RPC_NUM_FUNCTIONS 0
SoftwareSerial mySerial(10, 11);
#define PIN_ESP8266_SET 2
#define PIN_ESP8266_MODE 3
#define PIN_ESP8266_CH_PD 7
SoftwareSerial mySerial(10, 11);
//ArduRPC rpc = ArduRPC(RPC_NUM_HANDLERS, RPC_NUM_FUNCTIONS);
//ArduRPC_Serial rpc_serial = ArduRPC_Serial(RPC_SERIAL_PORT, rpc);
......@@ -19,11 +22,16 @@ SoftwareSerial mySerial(10, 11);
ArduRPCRequest rpc_request = ArduRPCRequest();
ArduRPCRequest_Serial h = ArduRPCRequest_Serial(rpc_request, RPC_SERIAL_PORT);
SensorWifiModuleRemote sensor_remote = SensorWifiModuleRemote(rpc_request, 0x10);
SensorWifiModuleRemote sensor_remote = SensorWifiModuleRemote(rpc_request, 0x00);
SensorNode sensor_node = SensorNode();
void setup() {
pinMode(PIN_ESP8266_SET, OUTPUT);
pinMode(PIN_ESP8266_MODE, OUTPUT);
pinMode(PIN_ESP8266_CH_PD, OUTPUT);
digitalWrite(PIN_ESP8266_CH_PD, LOW);
RPC_SERIAL_PORT.begin(RPC_SERIAL_BAUD);
/*sensor_dht = new DHT(6, DHT22);
sensor_dht->begin();*/
......@@ -39,6 +47,17 @@ void loop() {
//rpc_serial.readData();
//sensor_dht->readTemperature();
sensor_node.run();
digitalWrite(PIN_ESP8266_SET, HIGH);
digitalWrite(PIN_ESP8266_MODE, HIGH);
digitalWrite(PIN_ESP8266_CH_PD, HIGH);
// Wait for bootloader
delay(250);
digitalWrite(PIN_ESP8266_MODE, LOW);
digitalWrite(PIN_ESP8266_SET, LOW);
// Wait until boot
delay(250);
sensor_node.submitValues(&sensor_remote);
digitalWrite(PIN_ESP8266_CH_PD, LOW);
delay(5000);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment