# ThingSpeak esp8266

**URL:** <https://forum.makecode.com/t/thingspeak-esp8266/7656>\
**Category:** micro:bit\
**Created:** [April 27, 2021, 3:42pm UTC](https://forum.makecode.com/t/thingspeak-esp8266/7656 "2021-04-27T15:42:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![panaxao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/panaxao/32/4030_2.png) [@panaxao](https://forum.makecode.com/u/panaxao)\
**Post date:** [April 27, 2021, 3:42pm UTC](https://forum.makecode.com/t/thingspeak-esp8266/7656/1 "2021-04-27T15:42:47Z")

</div>

I use the following code for sending data from microbit using esp8266 to ThingSpeak

basic.show\_icon(IconNames.DIAMOND)  
ESP8266ThingSpeak.connect\_wifi(SerialPin.P1,  
SerialPin.P0,  
BaudRate.BAUD\_RATE115200,  
“ssid”,  
“pass”)  
if ESP8266ThingSpeak.is\_wifi\_connected() == True:  
basic.show\_icon(IconNames.YES)  
else:  
basic.show\_icon(IconNames.NO)  
ESP8266ThingSpeak.wait(10000)  
basic.clear\_screen()  
def on\_forever():  
ESP8266ThingSpeak.connect\_thing\_speak(“[api.thingspeak.com](http://api.thingspeak.com)”,  
“WRITE API KEY”,  
input.acceleration(Dimension.STRENGTH),  
input.magnetic\_force(Dimension.STRENGTH),  
input.temperature(),  
pins.analog\_read\_pin(AnalogPin.P10),  
0,  
0,  
0,  
0)  
basic.pause(60000)  
basic.forever(on\_forever)

The code worked properly for days. But suddenly it stops sending data after few minutes. I have to restart microbit in order to keep sending data. But, it stops again.  
Do you have any recommendation? I cannot find any help to net…

Thanks!
