[edit 2013-11-25: note that recent versions of pylibftdi have deprecated and then removed the ability to use 'Driver' in this way; replace
BitBangDevice in the code below]
Toggling an LED or other device from pin D0
from pylibftdi import BitBangDriver import time with BitBangDriver() as bb: while True: bb.port ^= 1 time.sleep(0.5)
Sending a string to a serial terminal
It's been tested on Linux (Ubuntu 10.10) and Mac OS X (10.6), with libftdi 0.17 and 0.18, but doesn't have any intended platform specific requirements other than having the libftdi library installed. The following goals for this project differentiate it from similar projects:
from pylibftdi import Driver with Driver() as drv: drv.baudrate = 19200 drv.write('Hello World!')
- Fully supported on Linux and Mac OS X, using Intra2net's open source libftdi driver.
- Simple things are very simple, as the example above shows. The basic functionality is made as simple as possible to use, with properties and context managers used where it makes sense. Most other FTDI Python wrappers are 'just' low level bindings of the underlying API.
- There will be an increasing library of examples showing interaction with various protocols and devices - note this is a goal, not yet an accomplishment, though there is an LCD example there.