feat:encoder with existing lib (#2)

Co-authored-by: Clement <c.boesmier@aptatio.com>
Reviewed-on: #2
This commit is contained in:
2023-10-20 18:32:17 +02:00
parent 6e2da886fc
commit 3a6d55c646
19 changed files with 1943 additions and 8 deletions

View File

@ -1,9 +1,12 @@
#include "Program.h"
Program::Program() {
// Startup
// Startup Serial
Serial.begin(MONITOR_SPEED);
// Startup WiFi
WiFi.begin(WSSID, PASS);
Serial.print("Connecting to ");
@ -12,7 +15,8 @@ Program::Program() {
int i = 0;
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(1000);
Serial.print(++i); Serial.print(' ');
Serial.print(++i);
Serial.print(' ');
}
Serial.println('\n');
@ -20,13 +24,19 @@ Program::Program() {
Serial.print("IP address:\t");
Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer
// Startup Discord API
this->discord = new DiscordAPI(DISCORD_HOOK);
delay(1000);
Serial.println(this->discord->sendHeure("10h", "18h"));
//Serial.println(this->discord->sendHeure("10h", "18h"));
// Startup Encoder
this->encoder = new SwitchableEncodeur(ENCODER_DT, ENCODER_CLK, ENCODER_SWITCH, 3);
}
void Program::loop() {
// Loop
if(this->encoder->update()){
Serial.print(this->encoder->getValue());
Serial.print(" ");
Serial.println(this->encoder->getMenu());
}
}