Implement ArduinoOTA, format arduino.cpp #1
25
arduino.cpp
25
arduino.cpp
@ -1,10 +1,10 @@
|
||||
|
||||
/***
|
||||
* Fuz Piedthon
|
||||
* Pedestrian traffic lights, green and red, controlled over MQTT
|
||||
* Board: ESP8266
|
||||
*
|
||||
*/
|
||||
Fuz Piedthon
|
||||
Pedestrian traffic lights, green and red, controlled over MQTT
|
||||
Board: ESP8266
|
||||
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
@ -22,10 +22,10 @@
|
||||
|
||||
#include "WifiCredFuz.cpp" // Wifi and MQTT Credentials
|
||||
/* with
|
||||
#define WLAN_SSID ""
|
||||
#define WLAN_PASS ""
|
||||
#define MQTT_USERNAME "" //omg no user
|
||||
#define MQTT_KEY "" //omg no key
|
||||
#define WLAN_SSID ""
|
||||
#define WLAN_PASS ""
|
||||
#define MQTT_USERNAME "" //omg no user
|
||||
#define MQTT_KEY "" //omg no key
|
||||
*/
|
||||
/// End of user config
|
||||
|
||||
@ -114,7 +114,7 @@ void messageToPiedthon(char *msg) {
|
||||
digitalWrite(GPIO_ROUGE, LOW);
|
||||
digitalWrite(GPIO_VERT, LOW);
|
||||
break;
|
||||
case '1' : // ROUGE
|
||||
case '1' : // ROUGE
|
||||
digitalWrite(GPIO_VERT, HIGH);
|
||||
digitalWrite(GPIO_ROUGE, LOW);
|
||||
break;
|
||||
@ -122,7 +122,7 @@ void messageToPiedthon(char *msg) {
|
||||
digitalWrite(GPIO_VERT, LOW);
|
||||
digitalWrite(GPIO_ROUGE, HIGH);
|
||||
break;
|
||||
case '3' : // Rien
|
||||
case '3' : // Rien
|
||||
digitalWrite(GPIO_ROUGE, HIGH);
|
||||
digitalWrite(GPIO_VERT, HIGH);
|
||||
break;
|
||||
@ -158,9 +158,8 @@ void loop() {
|
||||
while ((subscription = mqtt.readSubscription(5000))) {
|
||||
if (subscription == &sub_piedthon) {
|
||||
mqtt_message = (char *) sub_piedthon.lastread;
|
||||
Serial.println("Got: "+String(mqtt_message));
|
||||
Serial.println("Got: " + String(mqtt_message));
|
||||
messageToPiedthon(mqtt_message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user