Skip to content

Commit da83429

Browse files
isolverpeircej
authored andcommitted
BF: iohub PstBox P3 compat
- needs testing / verificatiuon.
1 parent d115e63 commit da83429

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

psychopy/iohub/devices/serial/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import serial
66
import sys
77
import numpy as N
8+
import struct
89
from ... import EXP_SCRIPT_DIRECTORY
910
from .. import Device, DeviceEvent, Computer
1011
from ...errors import print2err, printExceptionDetailsToStdErr
@@ -546,7 +547,7 @@ def _update_state(self):
546547
# Convert the new state into a bitmask, collapse it into a
547548
# single byte and send it to the response box.
548549
state_bits = (2**N.arange(8))[state]
549-
self.write(chr(N.sum(state_bits)))
550+
self.write(struct.pack("B",(N.sum(state_bits))))
550551

551552
# Set the `update lamp` bit to LOW again.
552553
state[6] = False

0 commit comments

Comments
 (0)