Serial communication of arduino through python using LEDS

Hello everyone,

I have a project idea and I wanted to know how I should approach this.

I have 5 LEDS I would like to control through python. When I checked the resources I have had, it seems by using serial port and pyserial library I will be able to connect to arduino and send some data. However, I would like to send big chunks of data and I didn't know how I should approach this.

Let me tell you what I have in mind to be exact.

I have a list of 5 variables in python.For example:

[1,0,0,25,50]

The variables won't exactly be the same. They can change up to 10000. The first three elements will control 3 leds such as if 1, turn the first light on and others off. The 4th and 5th elements are the number of blinks I would like the lights to do. The 4th light will blink 25 times and the 5th will blink 50 times.

How do you think I should send the bytes to arduino? I have been experimenting with serial.parseInt functions. Is this the right way? I have never had experience with serial communication before.

Thank you for your advices.

Have a look at Serial input basics - updated or ideas

Have a look at this Simple Python - Arduino demo

The Python code should work on Windows if you edit it to use the Windows style of COM ports.

See also Serial Input Basics - simple reliable non-blocking ways to receive data.

...R

You can easily send Python arrays to Arduinos (and vice versa) using the pip-installable pySerialTransfer and SerialTransfer.h libraries