
RoboPi v1.00
User Manual v0.85
Copyright 2014 William Henning
Introducing RoboPiLib
RoboPiLib is a library designed to interface the Raspberry Pi with the RoboPi firmware.
RoboPiLib was designed to make it easy to write programs on the Raspberry Pi that use all of the
firmware features of RoboPi, and was designed to be familiar to those coming to RoboPi from
WiringPi, Arduino or Wiring environments.
RoboPiLib is available for both Python and C, and the native Spin object uses the same API as
RoboPiLib.
The Python interface that is almost identical to the C interface – all you have to do is prefix the library
function names as follows:
Python Examples:
import RoboPiLib as RoboPi
# connect to RoboPi
RoboPi.RoboPiInit(“/dev/ttyAMA0”,115200)
# set pin 16 to an output and write 1 to it
RoboPi.pinMode(16,RoboPi.OUTPUT)
RoboPi.digitalWrite(16,1)
# set pin 17 to a PWM output and generate a 50% PWM on pin 17
RoboPi.pinMode(17,RoboPi.PWM)
RoboPi.analogWrite(17,127)
# read analog input 0
print RoboPi.analogRead(0)
http://Mikronauts.com
11
2014-01-27