microbit-foundation / micropython-microbit-v2

Temporary home for MicroPython for micro:bit v2 as we stablise it before pushing upstream
MIT License
42 stars 23 forks source link

Micro:Bit freeze when analog read #79

Closed ardaij closed 3 years ago

ardaij commented 3 years ago

Hi,

In our school, we programming micro:bits in MicroPython. For analog reading, the microbit freezes at irregular intervals.

The error can be reproduced with this code:

`from microbit import *

light = False

while True: pin1.read_analog() display.set_pixel(2, 2, 5 if light else 0) light = not light sleep(200) `

We use microbit v2 microcontrollers: MicroPython v1.13 on 2021-03-16; micro:bit v2.0.0-beta.5 with nRF52833 We tested this with 7 of the same Micro:Bits.

Please help us.

I also asked this question in another forum because I don’t know where we can get help.

Thanks

dpgeorge commented 3 years ago

This is likely the same as #73, and it was fixed by commit 291e05c8440de4e90dcf1f443136d2b7005272a1

Testing the above script with that commit, it doesn't freeze.

ardaij commented 3 years ago

I just built the micropython from the github repository, and I copied the hex file onto the microbits.

MicroPython v1.15-64-g1e2f0d280 on 2021-06-05; micro:bit v2.0.0-beta.5 with nRF52833

I ran the program for several hours without error. This seems to have solved the problem. Maybe it would be good if others tested it as well.

Thanks

And thank you for the MicroPython...

microbit-carlos commented 3 years ago

Glad you got it working and thanks for the report @ardaij! I'll close this as resolved as the fix will be present in the next release.