I am trying to use the telegram bot getMessage() function and im getting this error, even with the example code provided by the library. When i upload it, nodeMCU resets.
Serial monitor output:
Soft WDT reset
>>>stack>>>
ctx: cont
sp: 3ffff260 end: dec42428 offset: 01a0
3ffff400: 00002c04 3ffff430 3fff210c 402097ae
3ffff410: 00000000 3fff31cc 3fff06b4 00003a98
3ffff420: 00000000 0005688c 3fff06b4 402075c8
3ffff430: 000000dd 2e39c64b a187b169 dec96de6
3ffff440: 00000008 00000001 000020ee 00000000
3ffff450: 40223824 40223874 3fff210c 40222e62
3ffff460: 3fff260c 3ffef9a4 3fff210c 3ffef9a4
3ffff470: 00000000 00000001 3fff06b4 402076d3
3ffff480: 00000000 00000001 3fff06b4 402078c3
3ffff490: 000000fa 3ffeeb14 00000001 402096dc
3ffff4a0: 00000000 00000000 000001bb 40209df2
3ffff4b0: 00000000 3ffefcdc 3fff06b4 40206812
3ffff4c0: 3fff1fcc 3ffef90c 3ffe85f8 3ffff5dc
3ffff4d0: 000001bb 3ffef9a4 3fff06b4 3ffff5dc
3ffff4e0: 000001bb 3ffef9a4 3fff06b4 40207965
3ffff4f0: 4020cd20 dca79a95 4020cd20 dca79a95
3ffff500: 3ffe890e 3ffff640 3ffee8cc 4020c45c
3ffff510: 00000059 3ffff640 3ffee8cc 4020c05e
3ffff520: 3fff06b4 3ffff640 3ffee8cc 402050df
3ffff530: 4020ca0c 00000000 000007d0 40208e63
3ffff540: 00000000 00000000 00000000 3fff06b4
3ffff550: 3fff06b4 3ffef874 3ffef9a4 0010001f
3ffff560: 80000000 3ffff5c4 3ffff5ac 3ffff668
3ffff570: 00000001 3ffef8c4 3ffff5a0 40208f80
3ffff580: 3ffff6d8 3ffee8cc 3ffff640 3ffff668
3ffff590: 3ffff6d8 3ffee8cc 3ffff640 4020160b
3ffff5a0: 00000000 008e008f 00000000 00000000
3ffff5b0: 0059005f 00000000 00000000 0024bc9c
3ffff5c0: 00000000 00000000 004f004f 00000000
3ffff5d0: 00000000 004e004f 00000000 3ffef90c
3ffff5e0: 008e008f 80000000 3ffff668 40209088
3ffff5f0: 00000000 3ffffe50 3ffee8cc 00000000
3ffff600: 00000000 3ffffe50 3ffee8cc 40203106
3ffff610: 5c5c5c5c 5c5c5c5c 3ffefeac 3ffefeac
3ffff620: 3fff06ac 3fff06ac 5c5c5c00 5c5c5c5c
3ffff630: fa51fd5c fd235181 e89f9600 39208557
3ffff640: 10bd89c0 f005a6cb d1d3e3e4 792cd3fe
3ffff650: 8b5e582c dcbecf21 20d20929 cf8204bb
3ffff660: 363fa83c 154de314 55746567 74616470
3ffff670: 0a007365 4a733529 46a9415d 4bca0c51
3ffff680: 8ef2523a fdd87b69 0c081e6e c981ef62
3ffff690: ceb2262c c1e91b0c b3be1efe a1f0615c
3ffff6a0: 52eaa6cb 89c5430b 7148316c 5e17dbee
3ffff6b0: 19e95deb a436b472 cad54a81 5f587f95
3ffff6c0: d48b0030 eaba28fa 8079fe20 c0687848
3ffff6d0: 80000000 00000000 3ffef8c4 0035003f
3ffff6e0: 80000000 00000000 00000000 00000300
3ffff6f0: 76bb70d6 ee8625e2 dff28eb2 578f2948
3ffff700: 4e013865 8adad81c d3477f91 7f536b9e
3ffff710: be9427f6 b895b34b eeb956d9 00000080
3ffff720: 03030000 010000d4 9867e1cb 000047f6
3ffff730: a355a3bb f9cfa6f7 414b60e2 9cb8aee7
3ffff740: f1d90000 eed3af3b a8c02bc0 5acca9cc
3ffff750: 30c0acc0 2fc02cc0 afc023c0 adc0aec0
3ffff760: 28c009c0 27c024c0 14c02dc0 13c00ac0
3ffff770: 32c025c0 31c02ec0 2ac004c0 29c026c0
3ffff780: 0f009c00 0ec005c0 9dc0a0c0 9dc09cc0
3ffff790: 3d002f00 a1003c00 12c003c0 35c008c0
3ffff7a0: 5ed405a0 6f262399 2bca531a 275d3ae3
3ffff7b0: af246d1a c9c2f5d8 7aecbcc6 91eb3f2d
3ffff7c0: d657e2e2 3ab14942 435d6def ede3c38c
3ffff7d0: ea5f1454 25d31478 b64500fd b1839337
3ffff7e0: 00000005 00000000 00000020 4010018c
3ffff7f0: 4cbd73ce 7f0de38d 00000005 40101fa0
3ffff800: 3ffe9275 40105237 3ffeccb0 bfd73b57
3ffff810: 40102b2b 3ffeccb0 18be105f 396bc664
3ffff820: 00007fff 0062c199 3ffed5b8 40102d08
3ffff830: 3ffe9afc 00000000 00000000 40101fa0
3ffff840: 00007fff 0062c199 401031c2 00000100
3ffff850: 3ffe9afc 7fffffff 00002200 00000001
3ffff860: 00000001 000000d0 00000020 4010018c
3ffff870: 3ffe9afc ee0771fa 00000005 0062c199
3ffff880: 3ffe9b08 2c9f0300 4000050c 3fffc278
3ffff890: 40102ee4 3fffc200 00000022 1b9024a0
3ffff8a0: 40000f83 00000030 0000001b ffffffff
3ffff8b0: c664044a 371cfbe2 d6400542 64a322b0
3ffff8c0: 20410082 10cd660c 3f677b83 aa010017
3ffff8d0: 4c267210 df4b3742 c9396f56 a4083690
3ffff8e0: 13ee8c07 48506eeb 693560f3 01000204
3ffff8f0: cfe6044f 00003f00 3ffffac0 3ffffb80
3ffff900: cc7d71c0 a882a87f 3ffffad0 80f2b4c6
3ffff910: 622482c4 0000000a c672b434 9311d5b7
3ffff920: 5bea1baa 8b644f22 0000000a 3ffff980
3ffff930: 3ffffba0 0000c000 000f0000 00f00000
3ffff940: 00040c08 4030b0a0 040c0804 76b1ff4b
3ffff950: 0c014ecd 000d020e 010a0f03 538a9430
3ffff960: 40300000 c0007000 070a060c 3ffffc60
3ffff970: 3ffffc60 00000001 3ffffb80 3ffffa80
3ffff980: f3ccc0c3 f030fc03 f0f0c03f c00c03c3
3ffff990: cc3cc3c0 c03333cf f3f033f3 30cc33cf
3ffff9a0: 303cc0c0 300f33ff 30303ff3 3ffcff3f
3ffff9b0: c3f33f3f c00ff03c cfcf0f30 0fc3f03c
3ffff9c0: 0ff33f3f f0030f33 0ff0f3cf f3cc33f3
3ffff9d0: 3f30f30c c003cf0c 3c3cfc0f fc3f30f3
3ffff9e0: 03cf0cf3 30fffcf0 fccf303c cfc30fcf
3ffff9f0: f3f03003 3f00c3fc f30c3303 cc0c0f30
3ffffa00: 00c3fc30 f0cccccf c⸮HLL⸮⸮⸮⸮⸮⸮1⸮H⸮
Code:
/*
Name: lightBot.ino
Created: 17/01/2018
Author: Stefano Ledda <shurillu@tiscalinet.it>
Description: a simple example that do:
1) parse incoming messages
2) if "LIGHT ON" message is received, turn on the onboard LED
3) if "LIGHT OFF" message is received, turn off the onboard LED
4) otherwise, reply to sender with a welcome message
*/
#include "CTBot.h"
CTBot myBot;
String ssid = "mySSID"; // not replaced for security
String pass = "myPassword"; // not replaced for security
String token = "myToken"; // not replaced for security
uint8_t led = 2; // the onboard ESP8266 LED.
// If you have a NodeMCU you can use the BUILTIN_LED pin
// (replace 2 with BUILTIN_LED)
void setup() {
// initialize the Serial
Serial.begin(9600);
Serial.println("Starting TelegramBot...");
// connect the ESP8266 to the desired access point
myBot.wifiConnect(ssid, pass);
// set the telegram bot token
myBot.setTelegramToken(token);
// check if all things are ok
if (myBot.testConnection())
Serial.println("\ntestConnection OK");
else
Serial.println("\ntestConnection NOK");
// set the pin connected to the LED to act as output pin
pinMode(led, OUTPUT);
digitalWrite(led, HIGH); // turn off the led (inverted logic!)
}
void loop() {
// a variable to store telegram message data
TBMessage msg;
// if there is an incoming message...
if (CTBotMessageText == myBot.getNewMessage(msg)) {
if (msg.text.equalsIgnoreCase("LIGHT ON")) { // if the received message is "LIGHT ON"...
digitalWrite(led, LOW); // turn on the LED (inverted logic!)
myBot.sendMessage(msg.sender.id, "Light is now ON"); // notify the sender
}
else if (msg.text.equalsIgnoreCase("LIGHT OFF")) { // if the received message is "LIGHT OFF"...
digitalWrite(led, HIGH); // turn off the led (inverted logic!)
myBot.sendMessage(msg.sender.id, "Light is now OFF"); // notify the sender
}
else { // otherwise...
// generate the message for the sender
String reply;
reply = (String)"Welcome " + msg.sender.username + (String)". Try LIGHT ON or LIGHT OFF.";
myBot.sendMessage(msg.sender.id, reply); // and send it
}
}
// wait 500 milliseconds
delay(500);
}