Hi! Thanks for reading. I'm controlling the BlackBox via Python and PySerial on Raspberry Pi (Raspberry Pi OS). It works great. One problem I have and can't figure out is why I have to press the Reset button to get the script to work a second time. I have used this code on another controller board and I don't have this problem. When I connect to the Black Box via CuteCom or Arduino IDE Serial monitor, i don't have the problem. I feel like these programs are doing something to properly close the connection I'm not. Below is a sample script I've been using for testing purposes. If I use one of these terminal emulators to open and close the serial connection, then I am able to reconnect via PySerial. Thanks for any help. Code: import serial import time dev = serial.Serial('/dev/ttyUSB0', 115200, timeout=2) time.sleep(2) while(True): response = dev.readline().decode('utf-8').strip() print(response) uin = input("> ") if(uin == "quit"): dev.close() exit() uinb = bytes(uin, 'utf-8') dev.write(uinb) time.sleep(1)
Don't know Python/pyserial enough to help with your code, but compare against a known good Python sending script like https://github.com/gnea/grbl/tree/master/doc/script