Thursday, August 23, 2012

Python to Arduino Interface - Download

Download the Py2Ard Interface Library.  There are four files in this archive:
  • Py2Ard.ino - The sketch that provides the Arduino side of the interface.
  • Py2Ard.py - Python code that provides the host side of the interface - in my case running on a Raspberry Pi.
  • zzTestMotor.py - Test showing control of a motor.
  • zzTestLib.py - LED blink test also showing the use of Debug and Trace functions.
Please leave a comment below and I will let you know when a new version is available.

The above library is described in two posts, Part 1, and Part 2.


*** Note Note Note Note Note Note Note ***

I am a procedural guy trying to work in the object world and not getting far yet as you may notice from this code!   That said I am not sure WHY my call and return structure for this library is such that the call to the library returns only a status and then you have to go get the value (assuming the library returns one). 

I did not want to throw exceptions though I probably should but I am going to pivot to returning the value and then require a check for a clean return.   While I am doing this I will add an option where a bad return will throw an exception.

*** Note Note Note Note Note Note Note *** 

I have implemented this change in the new libraries available for download here and described here.

No comments:

Post a Comment