Python Robolib Constants; Python Robopilib Functions - Raspberry Pi RoboPi User Manual

Hide thumbs Also See for RoboPi:
Table of Contents

Advertisement

RoboPi v1.00

Python RoboLib Constants

Digital pins can be configured for one of the following four modes:
INPUT
OUTPUT
PWM
SERVO

Python RoboPiLib Functions

RoboPiInit(device, bps)
RoboPiExit()
readMode(pin)
pinMode(pin, mode)
digitalRead(pin)
digitalWrite(pin, val)
analogRead(chan)
analogReadRaw( pin)
analogWrite(pin, val)
servoRead(pin)
servoWrite(pin, val)
readDistance(int pin)
In your program, include the following at the top:
import RoboPiLib as RoboPi
See the example on the previous page to see how to use the Python interface.
http://Mikronauts.com
User Manual v0.85
pin mode for a digital input
pin mode for a digital output
pin mode for a PWM output (0..255)
pin mode for a servo output (0..2500)
use RoboPiInit("/dev/ttyAMA0",115200)
close the serial connection with RoboPi
returns int
returns INPUT/OUTPUT/SERVO/PWM
set pin to one of INPUT/OUTPUT/SERVO/PWM
returns int
returns 0 or 1 state of pin
sets pin to 0 or 1
returns int
returns 0..1023 from specified channel
returns int
returns 0..4095 from specified channel
write 0..255 to PWM pin (off to full on)
returns int
return last servo value written to pin
set servo on pin to val (0..2500 us)
returns int
return distance to nearest object in milimeters
Copyright 2014 William Henning
13
2014-01-27

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RoboPi and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents