(home)

Learning About Arduino and Python

Python + Firmata Install

$ easy_install pyserial
# e.g.
$ wget http://download.github.com/lupeke-python-firmata-17a02bf211f16f93a0bcf9498dcfd0298c7c82ed.tar.gz
python setup.py install
$ python
Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import firmata
>>> firmata.VERSION
'0.3'
>>>> 
>>> from firmata import *
>>> a = Arduino('/dev/tty.usbserial-XXXXXXXXXX', baudrate=57600) # Baudrate must match rate set in sketch
>>> a.pin_mode(13, firmata.OUTPUT)
>>> a.digital_write(13, firmata.HIGH) # LED on pin 13 on
>>> a.digital_write(13, firmata.LOW) # LED on pin 13 off
>>> a.serial.close()

Links

Additional links

code@rancidbacon.com