Recently, we design a type of raspberry pi wireless shield (or extension board) for raspberry pi. By using this rpi shield, you can conveniently control your objective, like LED, TANK, CAR, etc. In this example, by using this wireless shield, we control the LED lamp to breathe.
the video can be seen at: http://youtu.be/kgt7f3D9FCM
the rpi shield is at http://www.smartarduino.com/raspberry-pie-pi-rpi-wireless-shield-support-zigbee_p93897.html
Step 1: Main functions
Main functions:
1. Support XBee low power wireless module, and the Bluetooth module with XBee interface;
2. Support NRF24L01/NRF24L01+ low power 2.4G wireless transceiver module;
3. Support RFM12B-D (315MHz, 433MHz, 868MHz, and 915MHz) wireless transceiver module;
4. Integrate RGB LED light, by the soft PWM of raspberry pi GPIO, can control the colors and brightness, also can control the colorful breathe lamp, together with the wireless module.
Step 2: Login mobile
let xbee wireless module connect to mobile, to make mobile control raspberry pi board
Step 3: Pc control raspberry pi board
let PC connect xbee wireless module to control raspberry pi board.
Step 4: Let the lamp breathe
then we can make the lamp breathe.
video: http://youtu.be/kgt7f3D9FCM
Step 5: Code
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
RGB_R = GPIO.PWM(15, 50) # channel=15 frequency=50Hz
RGB_G = GPIO.PWM(16, 50) # channel=16 frequency=50Hz
RGB_B = GPIO.PWM(18, 50) # channel=18 frequency=50Hz
RGB_R.start(0)
RGB_G.start(0)
RGB_B.start(0)
try:
while 1:
for dc in range(0, 101, 5):
RGB_R.ChangeDutyCycle(dc)
time.sleep(0.1)
for dc in range(100, -1, -5):
RGB_R.ChangeDutyCycle(dc)
time.sleep(0.1)
for dc in range(0, 101, 5):
RGB_G.ChangeDutyCycle(dc)
time.sleep(0.1)
for dc in range(100, -1, -5):
RGB_G.ChangeDutyCycle(dc)
ime.sleep(0.1)
for dc in range(0, 101, 5):
RGB_B.ChangeDutyCycle(dc)
time.sleep(0.1)
for dc in range(100, -1, -5):
RGB_B.ChangeDutyCycle(dc)
time.sleep(0.1)
for dc in range(0, 101, 5):
RGB_R.ChangeDutyCycle(dc)
RGB_G.ChangeDutyCycle(dc)
time.sleep(0.1)
for dc in range(100, -1, -5):
RGB_R.ChangeDutyCycle(dc)
For more detail: for raspberry pi wireless shield extension board