#include <Simpletimer.h>
#include <WiFiManager.h>
#include <EasyButton.h>
// the timer object
Simpletimer timer{};
WiFiManager wm;
EasyButton button(14,50,true,true);
const uint16_t PixelCount = 1; // make sure to set this to the number of pixels in your strip
const uint8_t PixelPin = 12; // make sure to set this to the correct pin, ignored for Esp8266
unsigned long callbacksleep = 20;
int16_t counter=0;
void change_animation(){
counter++;
if(counter%10==0)Serial.printf("counter: %i\n",counter);
}
Simpletimer::callback cb = change_animation;
void onPressed()
{
Serial.println((digitalRead(14)));
Serial.println("Button pressed");
if(!wm.getConfigPortalActive())wm.startConfigPortal("Iforce");
else Serial.println("Config already active");
}
void onPressedFor(){
Serial.println("reset settings");
}
void setup()
{
Serial.begin(115200);
while (!Serial); // wait for serial attach
button.begin();
// Add the callback function to be called when the button is pressed.
button.onPressed(onPressed);
button.onPressedFor(1000,onPressedFor);
timer.register_multiple_callbacks(&cb, &callbacksleep);
wm.setConfigPortalBlocking(false);
wm.setConfigPortalTimeout(60);
bool res;
// res = wm.autoConnect(); // auto generated AP name from chipid
// res = wm.autoConnect("AutoConnectAP"); // anonymous ap
res = wm.autoConnect("Iforce"); // password protected ap
if(!res) {
Serial.println("Failed to connect");
// ESP.restart();
}
else {
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
}
}
void loop()
{
timer.run();
wm.process();
button.read();
//sleep(10);
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
rgb1:VDD
rgb1:DOUT
rgb1:VSS
rgb1:DIN
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
r1:1
r1:2
led1:A
led1:C
r2:1
r2:2