Hello guys,
i need help in my project
yeaaa, i want to make LED control using nodemcu and telegram
after iam upload, its no error
but NodeMCU cant connect to telegram.
i dunno why?
when i check test connection, its always error
my code
#include "CTBot.h"
CTBot faiq;
int led = 16;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(led, OUTPUT);
digitalWrite(led, 0);
faiq.wifiConnect("eyip", "passw0rd");
faiq.setTelegramToken("1144162862:AAF0DTzvcFpRe-vrgF0D9-gH0Qx_5lQoEMI");
if (faiq.testConnection()) {
Serial.println("connected");
}
else {
Serial.println("error");
}
}
void loop() {
// put your main code here, to run repeatedly:
if (faiq.testConnection() == 0) {
Serial.println("error");
}
if (faiq.testConnection() == 1) {
Serial.println("berhasil");
while (1) {
TBMessage message;
if (faiq.getNewMessage(message)) {
Serial.print("Incoming Message : ");
Serial.println(message.text);
if (message.text.equalsIgnoreCase("ON")) {
digitalWrite(led, 1);
faiq.sendMessage(message.sender.id, "LED ON");
}
else if (message.text.equalsIgnoreCase("OFF")) {
digitalWrite(led, 0);
faiq.sendMessage(message.sender.id, "LED OFF");
}
else {
String answer;
answer = "wrong";
faiq.sendMessage(message.sender.id, answer);
}
}
}
}
delay(200);
}
maybe anyone can help me? or maybe any other program that i can try.
i just want to connect my nodemcu to telegram, but now iam frustated.
i buy 2 nodeMCU, first amica and then lolin, and both i cant connect to telegram
iam using CTBot. and TelegramBot, and UniversalTelegramBot, but always error
my NodeMCU can connect to wifi, but error in telegram.
my setting