Si en el sketch palette se desmarcan las opciones, luego no permite hacer el press/pull!!!!!
Se deben dejar marcadas!
Si en el sketch palette se desmarcan las opciones, luego no permite hacer el press/pull!!!!!
Se deben dejar marcadas!
// ¡¡¡¡¡¡USAR CON LIBRERIA ARDUINOJSON VERSION 5.13.5!!!!!
//En IDE ir a Programa->Incluir librería->Gestionar librerias->Arduinojson->seleccionar version
#include "CTBot.h"
CTBot myBot;
String ssid = "xxxxxxx";
String pass = "yyyyyyy";
//Poner tu Telegram BOT TOKEN
String token = "aaaaaaaaa:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
const int alarma = D1;
long id=123456789; //chat_id
void setup() {
Serial.begin(115200);
myBot.wifiConnect(ssid, pass);
myBot.setTelegramToken(token);
pinMode(2,OUTPUT);
digitalWrite(2, HIGH); //LED apagado
pinMode(alarma, INPUT_PULLUP);
// ¿Todo va bien?
if (myBot.testConnection())
Serial.println("\nConexion OK");
else
Serial.println("\nConexion fallida");
}
void loop() {
TBMessage msg;
myBot.getNewMessage(msg);
myBot.sendMessage(msg.sender.id, "LED apagado");
while(true) {
delay(50);
yield();
}
}
En el loop, agregar delay y yield:
void loop() {
...
...
delay(50);
yield();
}