IQ gen 2 serial communication between computer and brain

Hi, i can send data from the brain to the computer by opening the user’s serial port available once the hub is connected via usb cable.
I do that simply using the print function in python.
However, how do i listen for data in the opposite direction (sent by the computer, listening on the brain). I don’t see any documentation to read data from the serial port in the vex python api.

i looked online but i think all i found was exp/v5 info.
relevant but not the same: Input() in VEX IQ Gen 2 Python

thank you

1 Like

You could try this, may work

1 Like

Hi, using open as in the code above does not work.
Here is what i found working:

import sys

def test():
    while True:
        print(1)
        wait(500,MSEC)

t1=Thread(test)

while True:
    data=sys.stdin.readline()
    brain.screen.clear_screen()
    brain.screen.set_cursor(1,1)
    brain.screen.print(data)
 

the test function is not needed, i just wanted to test threads together with serial receiving and sending data at the same time.

thank you