MICROBIT - Serial read line

39 Views Asked by At

May I ask how does the serial read line work? I was trying to make an automated door lock where if I send a signal through serial(I'm using tera term), the microbit should send a radio message to another to unlock my door.


def on_button_pressed_a():
    basic.show_string(serial.read_line())
    
input.on_button_pressed(Button.A, on_button_pressed_a)

serial.write_line("test")

(^ Converted to python from blocks)


Currently, all the code does is to send a test message to the serial port and to receive a message from the serial port then to display it once I press the A button.

However, tera term can only READ signals from the serial but I can't type a thing on tera term.

May I ask how do I solve this or does this just not work?

Thanks!

1

There are 1 best solutions below

0
Isaac Chow On BEST ANSWER

Enable local echo


Go to setup -> Terminal and change both receive and transmit to CR+LF and tick the "Local Echo" box


Thanks @Hans Passant (See comments)