-
Notifications
You must be signed in to change notification settings - Fork 0
/
iotsa433.ino
56 lines (44 loc) · 1.43 KB
/
iotsa433.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
52
53
54
55
//
// Boilerplate for configurable web server (probably RESTful) running on ESP8266.
//
// The server always includes the Wifi configuration module. You can enable
// other modules with the preprocessor defines. With the default defines the server
// will allow serving of web pages and other documents, and of uploading those.
//
#include <Esp.h>
#include "iotsa.h"
#include "iotsaWifi.h"
#include "iotsa433Send.h"
#include "iotsa433Receive.h"
// CHANGE: Add application includes and declarations here
#define WITH_OTA // Enable Over The Air updates from ArduinoIDE. Needs at least 1MB flash.
#define WITH_LED // Enable status led
#define NEOPIXEL_PIN 15
IotsaApplication application("Iotsa 433Mhz Home Automation Remote Control Server");
IotsaWifiMod wifiMod(application);
Iotsa433SendMod sendMod(application);
Iotsa433ReceiveMod receiveMod(application);
#ifdef WITH_OTA
#include "iotsaOta.h"
IotsaOtaMod otaMod(application);
#endif
#ifdef WITH_LED
#include "iotsaLed.h"
IotsaLedMod ledMod(application, NEOPIXEL_PIN);
#endif
void setup(void){
application.setup();
application.serverSetup();
// For some reason trying to create the callbacks with std::bind doesn't work,
// and crashes during initialization.
receiveMod.setStatusCallbacks(
[]{ ledMod.set(0x002000, 250, 0, 1); },
[]{ ledMod.set(0x200000, 1000, 0, 1); }
);
#ifndef ESP32
ESP.wdtEnable(WDTO_120MS);
#endif
}
void loop(void){
application.loop();
}