Problem w. microbit V2 and uart

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
Posts: 4
Joined: Tue Jan 19, 2021 8:48 pm

Problem w. microbit V2 and uart

Post by Herve_14 » Sun Jan 31, 2021 2:37 pm

I have a problem w/ uart microbit's V2 uart.
This simple test code works fine w V1.5 but i get error 11 with V2 at line "" or "uart.readinto(Buf_Uart)" :

from microbit import *


Entete_Trame ="ABCDE"

while True :

if uart.any() : #error 11

uart.readinto(Buf_Uart) #error 11

if chr(Buf_Uart[0]) in Entete_Trame :

print ("Bien recu : ", chr(Buf_Uart[0]))

if chr(Buf_Uart[0])=="F" :
Pitch_Consigne= 1

elif Buf_Uart[0]=="B" :
Pitch_Consigne= -1

elif Buf_Uart[0]=="A" :
Pitch_Consigne= 0

else :
print ("Hors trame :", chr(Buf_Uart[0]))

Is there something wrong in my code?


Post Reply