Search found 969 matches

by kevinkk525
Fri Jan 31, 2020 2:39 pm
Forum: General Discussion and Questions
Topic: Connecting to AWS with MQTT
Replies: 39
Views: 41658

Re: Connecting to AWS with MQTT

Did you try using the AWS IOT mqtt with a CPython mqtt client like paho.mqtt?
by kevinkk525
Fri Jan 31, 2020 2:38 pm
Forum: General Discussion and Questions
Topic: Properly checking for errors during a WiFi connection?
Replies: 13
Views: 23410

Re: Properly checking for errors during a WiFi connection?

you import network so STAT_NO_AP_FOUND is not defined in global space but in network.

Therefore you have to check against "network.STAT_NO_AP_FOUND" or do "from network import *"
by kevinkk525
Fri Jan 31, 2020 10:56 am
Forum: Programs, Libraries and Tools
Topic: Control exact polling rates using uasyncio
Replies: 16
Views: 6887

Re: Control exact polling rates using uasyncio

... I always thought the interrupt can interrupt while another operation is reading an object and that only a 1Byte operation is atomic, but I might be wrong. As Dave says this is arch dependent. For example an N byte wide bus can enforce atomic N byte access at the hardware level. How big is N for...
by kevinkk525
Fri Jan 31, 2020 8:28 am
Forum: Programs, Libraries and Tools
Topic: Control exact polling rates using uasyncio
Replies: 16
Views: 6887

Re: Control exact polling rates using uasyncio

On most 32-bit architectures (and definitely on the ARM), retrieving or storing a 32-bit value is an atomic operation. You'll never get 3 bytes from one time and an additional byte from an interrupt handler. I always thought the interrupt can interrupt while another operation is reading an object a...
by kevinkk525
Thu Jan 30, 2020 10:02 pm
Forum: Programs, Libraries and Tools
Topic: Control exact polling rates using uasyncio
Replies: 16
Views: 6887

Re: Control exact polling rates using uasyncio

no we are not using threads. in threads you would have the problem that the control could be taken away from both threads. In this case the control can only be taken from the main loop. However, the main loop only accesses the pointer but doesn't modify it. The interrupt always runs to end and there...
by kevinkk525
Thu Jan 30, 2020 9:54 pm
Forum: General Discussion and Questions
Topic: Connecting to AWS with MQTT
Replies: 39
Views: 41658

Re: Connecting to AWS with MQTT

if you need to disconnect then you don't have working code.. how is that code supposed to work when you subscribe to a message and wait for a message on that topic?
by kevinkk525
Thu Jan 30, 2020 7:36 am
Forum: Programs, Libraries and Tools
Topic: Control exact polling rates using uasyncio
Replies: 16
Views: 6887

Re: Control exact polling rates using uasyncio

If sending the command is needed then you could measure how long it takes to run the interrupt, just to be sure that it doesn't take too long. Your 5ms interval however could make it difficult. The UART has a buffer, so it should be possible to read multiple values back from it. I can't tell you how...
by kevinkk525
Wed Jan 29, 2020 3:24 pm
Forum: ESP8266 boards
Topic: NodeMCU V3 and HC-SR04
Replies: 6
Views: 3294

Re: NodeMCU V3 and HC-SR04

That's good news! Thanks for sharing your findings.
by kevinkk525
Tue Jan 28, 2020 9:48 pm
Forum: Programs, Libraries and Tools
Topic: Control exact polling rates using uasyncio
Replies: 16
Views: 6887

Re: Control exact polling rates using uasyncio

I see a few problems with your code so I'll try to break it down: timer.init(period=5, mode=Timer.PERIODIC, callback=timed_poll()) It should be "timer.init(period=5, mode=Timer.PERIODIC, callback=timed_poll)" buf = bytearray(100) # Is an explicit global buffer needed and this the right place to crea...