We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, When I execute this code, I get an error when executing uart.write. The error is "TypeError: object with buffer protocol required"
any help would be appreciated.
from microbit import * uart.init(baudrate=9600, bits=8, parity=None, stop=1, tx=pin0, rx=pin1) request = "" while True: if button_a.is_pressed(): uart.write("hello world") uart.write("\n") if button_b.is_pressed(): request = uart.readinto(request) uart.write(request)
I
The text was updated successfully, but these errors were encountered:
Have you read http://microbit-micropython.readthedocs.io/en/latest/uart.html#microbit.uart.uart.readinto ? You can't write an integer with uart.write, you have convert it to a string. But I think that your code should fail much earlier, as soon as it gets to uart.readinto -- you can't call that on a string, you need a mutable type.
Sorry, something went wrong.
ah! thanks, newbie error.
No branches or pull requests
Hi,
When I execute this code, I get an error when executing uart.write. The error is "TypeError: object with buffer protocol required"
any help would be appreciated.
from microbit import *
uart.init(baudrate=9600, bits=8, parity=None, stop=1, tx=pin0, rx=pin1)
request = ""
while True:
if button_a.is_pressed():
uart.write("hello world")
uart.write("\n")
if button_b.is_pressed():
request = uart.readinto(request)
uart.write(request)
I
The text was updated successfully, but these errors were encountered: