forked from fjavier21/nodemcu22
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UBIDOTSLED.ino
40 lines (31 loc) · 939 Bytes
/
UBIDOTSLED.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
#include "Ubidots.h"
#define DEVICE "esp-8266" // nombre de equipo
#define TOKEN "BBFF-oqUrcbCh39PxOUEKdrik9vLRhgj6tQ" // token ubidots
#define VARIABLE "leda" // led variable
#define WIFISSID "INVITADOS CFD" // Put here your Wi-Fi SSID
#define PASSWORD "CFD2021$" // Put here your Wi-Fi password
Ubidots client(TOKEN);
const byte Pin_led = D4;
void setup() {
Serial.begin(115200);
client.wifiConnect(WIFISSID, PASSWORD);
pinMode(Pin_led, OUTPUT);
digitalWrite(Pin_led, LOW);
}
void loop()
{
float Valor_Led = client.get(DEVICE, VARIABLE);
if (Valor_Led != ERROR_VALUE){
Serial.print(F(">>>>>>>>> VALOR OBTENIDO POR EL LED: "));
Serial.println(Valor_Led);
if (Valor_Led==1){
digitalWrite(Pin_led, HIGH);
}else
{
digitalWrite(Pin_led, LOW);
}
}else{
Serial.println(F("Error obteniendo Valor_Led"));
}
delay(500);
}