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