-
Notifications
You must be signed in to change notification settings - Fork 3
/
ubidotsprueba1.ino
75 lines (52 loc) · 1.48 KB
/
ubidotsprueba1.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <ESP8266WiFi.h>
#include "Ubidots.h"
#define DEVICE "esp-8266" // nombre de equipo
#define TOKEN "BBFF-oqUrcbCh39PxOUEKdrik9vLRhgj6tQ" // token ubidots
#define VARIABLE "leda" // led variable
#define led2 "ledb" //variable 2
/*#define led3 "ledc" */
#define WIFISSID "Red1" // wifi
#define PASSWORD "12345frank" // pass
Ubidots client(TOKEN);
const byte Pin_led = D4;
const byte Pin_leds= D2;
/*const byte Pin_ledss= D0;*/
void setup() {
Serial.begin(115200);
client.wifiConnect(WIFISSID, PASSWORD);
pinMode(Pin_led, OUTPUT);
digitalWrite(Pin_led, LOW);
pinMode(Pin_leds, OUTPUT);
digitalWrite(Pin_leds, LOW);
/* pinMode(Pin_ledss, OUTPUT);
digitalWrite(Pin_ledss, LOW);*/
}
void loop()
{
float Valor_Led= client.get(DEVICE, VARIABLE);
float Valor_Leds= client.get(DEVICE, led2);
/* float Valor_Ledss= client.get(DEVICE, led3);*/
Serial.println(Valor_Led);
Serial.println(Valor_Leds);
/*Serial.println(Valor_Ledss);*/
if (Valor_Led==1){
digitalWrite(Pin_led, HIGH);
}
else {
digitalWrite(Pin_led, LOW);
}
if (Valor_Leds==1){
digitalWrite(Pin_leds, HIGH);
}
else {
digitalWrite(Pin_leds, LOW);
}
/* if (Valor_Ledss==1){
digitalWrite(Pin_ledss, HIGH);
}
else {
digitalWrite(Pin_ledss, LOW);
}
*/
delay(2000);
}