Originally Posted by
Andy
Was any of this helpful?
It works. Here is some python code that will start a session.
to use you need install the pyserial requirement.
Code:
pip3 install pyserial
I tested this on Windows. You can get your COM port from Device Manager. Or from Procyon AVS...
I can't recall ever writing to a serial port so go easy on me. Happy to receive constructive feedback.
Code:
import serial
import struct
port =serial.Serial(
"COM4",
baudrate=19200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
writeTimeout = 0,
timeout = 10,
rtscts=False,
dsrdtr=False,
xonxoff=False)
#this will output the checksum hi and low bits.
#TODO create function that takes in the byte array and appends the hi and low checksum bits
print(struct.pack('<h', 0xF1));
# joey based on doc trying to set to PC mode
# this doesn't really work, or at least it doesn't change the display to PC mode.
#data=bytes([0xA3,0x33,0x07,0x18,0x01,0x00,0xF6])
#=F4 = 11110100
# do you hear me? I think so.
#data=bytes([0xA3,0x33,0x06,0x20,0x00,0xFC])
# if in dL1 response: A3,04!,01,08
# start/stop session - this works if mode is set to Session which is the default when the Procyon turns on.
# but it just plays whatever session number is already showing on the Procyon display.
# there doesn't seem to be a way to change the session number programatically.
data=bytes([0xA3,0x33,0x06,0x15,0x00,0xF1])
#response = b'\xa3@\x04\xa1\x01\x88'
# which honestly doesnt' make a lot of sense. a1 means OK, but why is there an @ symbol in the first byte and where did the documented 0x3A second byte go. The 4th byte is the acknowledgement 0xa1 means OK.
print(port.isOpen())
print("Port opened...")
port.write(data)
print("Data sent")
while True:
print("inside while")
response=port.read(8)
print(response)
print ("Data Received")
break
Sadly I'm not sure this will be useful for me unless I build a robot to control the physical Procyon hardware. I can start and stop a session, but I can't select which session to run. It just runs which ever session is showing on the Procyon Screen. Although interestingly, the Procyon seems to remember which session was selected during it's last run when I turn it on. So if I physically select session 8 using the Procyon buttons and then pull the USB cord (with no batteries inside), when I plug the usb cord back in the Procyon defaults to Session 8. So if my setup only used 1 session this would be fine. I currently have 6 sessions, so I suppose I could have 8 procyons, each set to 1 of the 6 sessions and then programmatically tell an individual Procyon to start it's session based on which one I want.
I tried sending a mode change to Session 0x00 repeatedly. I was hoping that if I told it to switch modes to the mode it's already in that maybe it would increment which session it was on. No luck.
This might be super useful for other people though. There' information on how to send segments.
Joey.
Bookmarks