User Manual

38
led.py
Control the LED ring on top of the PiSmart box.
The ring consists of 2 groups of LEDs.
Create an instance, to which a parameter ['led1', 'led2'] can be transferred; the two objects
control the two groups of LEDs respectively. Or with no parameters, then it controls the whole
ring of LEDs.
from pismart.led import LED
my_leds = LED() # creat led object for all leds
led1 = LED('led1') # creat led1 object for led1 group
led2 = LED('led2')
brightness
Check and set the brightness of the LED. Assignable with integers ranging [0~100]
led_bri = my_leds.brightness # get led brightness
my_leds.brightness = 60 # set led brightness
off()
Switch off the LED, method function, with no parameters.
my_leds.off() # set led off
motor.py
Control the motor connected to PiSmart.
Create an instance, with 2 parameters:
channel ['MotorA','MotorB'], channel of motor output. forward [0, 1], direction turning of the
motor, 0 by default when no parameter is sent.
from pismart.motor import Motor
from pismart.pismart import PiSmart
p = PiSmart()
motorA = Motor("MotorA") # creat motor instance
SunFounder