-
Notifications
You must be signed in to change notification settings - Fork 4
/
Remote.ino
58 lines (39 loc) · 1.03 KB
/
Remote.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
Remote.ino - Handle RF 433 remote device
Saul bertuccio 5 feb 2017
Released into the public domain.
*/
#include "Arduino.h"
ADC_MODE(ADC_VCC);
#include "DeviceHandler.h"
#include "ConnectionManager.h"
#include "Portal.h"
Portal portal;
String ssid, pass;
void setup() {
Serial.begin(115200);
delay(2000);
Serial.print("ESP8266 chip id: ");
Serial.println(ESP.getChipId());
Serial.print("ESP8266 velocita flash: ");
Serial.println(ESP.getFlashChipSpeed());
Serial.print("Tensione di alimentazione : ");
Serial.println(ESP.getVcc());
Serial.print("Ultimo motivo reset: ");
Serial.println(ESP.getResetReason());
Serial.println("Configuro connessione Wifi");
ConnectionManager::initConnection();
Serial.println("Avvio webserver");
while (!portal.setup()) {
Serial.println("Impossibile configurare Server HTTP");
delay(10000);
}
}
void loop() {
portal.handleRequest();
if (portal.needRestart()) {
Serial.println("Riavvio il dispositivo");
delay(5000);
ESP.restart();
}
}