You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
611 B
Python

#!/usr/bin/python
import os,sys,math
import numpy as np
from amsswcomm import *
import time
## Setup
GPIO.setmode(GPIO.BOARD);
#other mode is GPIO.BCM - pin numberings are different?
com = amsswcomm()
com.comminit(1,3,7,5,4)
while(True):
msg = input("Cmd: ")
msgb = msg.encode(encoding="utf-8")
msgb = np.frombuffer(msgb, dtype=np.uint8)
t0 = time.time()
t = time.time()
com.send_message(msgb)
while(com.has_message()==False and (t<t0+1)):
com.update_step()
t = time.time()
reply = com.recv_message()
print("reply: {}".format(reply))