Description: This example shows how to receive one by one the available messages in the buffer that have the specified ID. Remember to connect the FTDI module in loopback mode. For more information consult the readme file ---------------------------------------------------------------------- Version: 0.0.1 | Last Modification: 10/07/2019 Author: Robert Vasquez Zavaleta Contact: [email protected] """ import jitbus import time myJitbus = jitbus.JitbusUSB() myJitbus.open("COM10", 3000000, 0.00000001) #We will send and receive data 20 times for x in range(20): print("Iteration: ", x) #We send four messages in a row, two with an ID and two with other myJitbus.sendMsg(0x1D4, x) myJitbus.sendMsg(0x0FF, x + 1) myJitbus.sendMsg(0x0FF, x + 2) myJitbus.sendMsg(0x1D4, x + 3) print("Id: ", 0x1D4, " Sent: ", x) print("Id: ", 0x0FF, " Sent: ", x + 1)
ports = glob.glob('/dev/tty.*') else: raise EnvironmentError('Unsupported platform') result = [] for port in ports: try: s = serial.Serial(port) s.close() result.append(port) except (OSError, serial.SerialException): pass return result atomRMS = jitbus.JitbusUSB() window = Tk() w = 520 # width for the Tk root h = 330 # height for the Tk root # get screen width and height ws = window.winfo_screenwidth() # width of the screen hs = window.winfo_screenheight() # height of the screen # calculate x and y coordinates for the Tk root window x = (ws / 2) - (w / 2) y = -100 + ((hs / 2) - (h / 2)) # set the dimensions of the screen