Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example throws error #36

Open
ghost opened this issue Aug 23, 2018 · 1 comment
Open

example throws error #36

ghost opened this issue Aug 23, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 23, 2018

the first exchange "who_are_you" works fine, however for the sequence

c.send("sum_two_ints",4,1)
msg = c.receive()

python 3.6 throws this error on the receive line:
struct.error: unpack requires a buffer of 2 bytes

@headrotor
Copy link

This is probably caused by using a different microcontroller than the default Atmel. This worked for me on a Teensy (arm)

       # Board input parameters:
       #      int_bytes: number of bytes to store an integer
       #      long_bytes: number of bytes to store a long
       #      float_bytes: number of bytes to store a float
       #      double_bytes: number of bytes to store a double``

       #  These can be looked up here:
       #      https://www.arduino.cc/en/Reference/HomePage (under data types)`


arduino = PyCmdMessenger.ArduinoBoard("/dev/ttyACM0",baud_rate=9600)
teensy = PyCmdMessenger.ArduinoBoard("/dev/ttyACM0",
                                     int_bytes=4,
                                     baud_rate=9600)

...
# Initialize the messenger
c = PyCmdMessenger.CmdMessenger(teensy,commands)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant