Hi,
I try to make screen for read UID number of and mifare card.
I put USB card-reader on my computer (the gateway is on a server) look for my port number (COM6) and try my code in the designer script console.
port_com = "COM6"
system.serial.configureSerialPort(
port=port_com,
bitRate = system.serial.BIT_RATE_9600
)
system.serial.openSerialPort(port_com)
try:
uid = system.serial.readBytesAsString(port_com,12)
print uid
system.tag.writeAsync("[BorneChauffeur]test", uid)
except Exception as e:
print "Error in communication with %s: %s" % (port_com, str(e))
finally:
#system.serial.closeSerialPort(port_com)
print ""
This works perfectly!
If I try to put script on a button, it's tell me that he can't open port COM6.
I try many other way to open port COM but nothing work (session even, on startup...)
Have you got any idea?
thanks in advance.