Demo sending binary data from PC to Arduino

I needed to figure out how to send binary data from my PC to an Arduino for a project to control 3 stepper motors. I thought the demo code might be of interest to Forum users.

The attached Python code sends 5 numbers to the Arduino - in Arduino terms they are an UNSIGNED LONG, 3 INTs and a BYTE.

In the demo the Arduino just sends the numbers back to the Python script to show they were properly received.

The Arduino code uses a STRUCT and a UNION to simplify the receipt and usage of the data from the PC.

The Python code as some similarities with the demo here.

…R (2.85 KB)

ReceiveBinary.ino (2.05 KB)

This is a test - please ignore

Planning an Implementing a Program Several things at a time Serial Input Basics Stepper Motor Basics Python-Arduino Comms Python GUI demo EzScrn



Your every link/post is like a good book to me and many.

Thanks a lot. Keep up the good work!