For Pan and/or Tilt movement, following API's are provided by Pi-Pan library:
Tilt the Pi-Pan head to 'y' position.
y: the tilt position of Pi-Pan ranging from 80 to 220, where
- 80 = looking down
- 220 = looking up
- 150 = straight ahead (neutral position)
Pan the Pi-Pan head to 'x' position.
x: the Pan position of Pi-Pan ranging from 50 to 250, where,
Bring the Pi-Pan head to neutral Pan position (straight ahead).
Bring the Pi-Pan head to neutral tilt position (straight ahead).
Pi-Pan Servo Controller board can control upto 6 servos. The servo pins are marked with S0 to S5. Depending on your product configuration, some pin headers may not be populated. If you need to extend the board functionality, solder standard (0.1 inch pitch) header pins on the board.
Pi-Light can be turned on (or off) with any combination of three basic colors (Red, Green and Blue).
Turning it on with all three colors in equal intensity will get you White light.
To turn off, set all color values to zero.
Program below moves the Pi-Pan head up/down in a while loop.
import time import os, sys import pipan p = pipan.PiPan() x = 150 while 1: # move head down while x < 180: p.do_tilt (int(x)) time.sleep(0.1) x += 2 # move head up while x > 90: p.do_tilt (int(x)) time.sleep(0.1) x -= 2
Program below turns Pi-Light on with White color, and then changes to basic colors at 1 second intervals, and then switches off.
import time import os, sys import pilight pl = pilight.PILIGHT() pl.createPiLight(255,255,255) time.sleep(1) pl.createPiLight(255, 0, 0) time.sleep(1) pl.createPiLight(0, 255, 0) time.sleep(1) pl.createPiLight(0, 0, 255) time.sleep(1) pl.createPiLight(255,255,255) time.sleep(1) pl.createPiLight(0, 0, 0)
There are several API's and programs to take pictures using Pi Camera.
To take picture with Pi-Pan 'raspistill' program is used, as follows:
# take the picture and save as test.jpg in /var/tmp folder. subprocess.call(["raspistill", "-o", "/var/tmp/test.jpg", "-rot", "180"])
For more info on taking pictures with Pi Camera Module, visit Matt's page at: