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
I have written a simple program that passes characters received over SSH onto the UART device that my OPi Zero 2 is connected to.
However, for some reason after a few messages, characters begin to arrive out of order.
Program (passthru.py):
import wiringpi import sys import argparse from time import sleep from sshkeyboard import listen_keyboard angle1 = 10 angle2 = 0 parser = argparse.ArgumentParser(description='') parser.add_argument("--device", type=str, default="/dev/ttyS5", help='specify the serial node') args = parser.parse_args() wiringpi.wiringPiSetup() serial = wiringpi.serialOpen(args.device, 115200) if serial < 0: print("Unable to open serial device: %s"% args.device) sys.exit(-1) def readSerial(): try: while (wiringpi.serialDataAvail(serial) != -1): print(chr(wiringpi.serialGetchar(serial)), end = '') sys.stdout.flush() #sleep(0.02) except ValueError: pass except KeyboardInterrupt: sys.exit(0) def press(key): key = key.capitalize() if (key != "Enter"): print(key, end = '') sys.stdout.flush() wiringpi.serialPrintf(serial, key) else: print("\n", end = '') sys.stdout.flush() wiringpi.serialPutchar(serial, 10) #newline readSerial() wiringpi.serialFlush(serial) sys.stdout.flush() listen_keyboard(on_press=press) wiringpi.serialClose(serial) # Pass in ID
Output:
The text was updated successfully, but these errors were encountered:
Additional info: restarting the sketch makes the input clear up every time, the first block of text always comes through OK.
Sorry, something went wrong.
No branches or pull requests
I have written a simple program that passes characters received over SSH onto the UART device that my OPi Zero 2 is connected to.
However, for some reason after a few messages, characters begin to arrive out of order.
Program (passthru.py):
Output:
The text was updated successfully, but these errors were encountered: