Demo of PC-Arduino comms using Python

I thought it may be useful to produce a slightly simpler version of the Python - Arduino example which only uses printable characters. That means that the Arduino program can be worked from the Serial Monitor as well as with the Python program.

The new version also contains elements of the code from this Thread to illustrate how to parse the data and use it to control LEDs and a servo.

The Arduino code assumes there are LEDS connected to pins 12 an 13 and a servo connected to pin 8.

If you send <LED1, 200, 0.5> to the Arduino it will set the flash interval for LED1 to 200 millisecs and will move the servo to 50% of its range.

As before there is also a JRuby version of the PC program for anyone that may be interested.

EDIT 22 Nov 2018 - Python3 version added - change the file type from .txt to .py

...R

ArduinoPC2.ino (4.07 KB)

ComArduino2.py (4.55 KB)

ComArduino2.rb (2.95 KB)

ComArduino2PY3.txt (4.89 KB)

2 Likes