Yeah, We got Pi!
  page01| page02| page03| page04| page05| page06| page07| page08| page09| page10

GPIO

#install python libs
sudo apt-get install python-dev

#Download gpio libs from https://pypi.python.org/pypi/RPi.GPIO and place in ~/gpio/
#unpack and install
cd ~/gpio/
tar xzvf RPi.GPIO0.5.2a.tar.gz
cd RPi.GPIO0.5.2a.tar.gz
sudo python setup.py install OR
sudo apt-get install python-rpi.gpio (personally untested)

GPIO EXAMPLE SOFTWARE
flash_leds.py

from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
while 1:
     GPIO.output(13, False)
     print("green on")
     sleep(1)
     GPIO.output(13, True)
     print("green off")
     sleep(1)

     GPIO.output(15, False)
     print("yellow on")
     sleep(1)
     GPIO.output(15, True)
     print("yellow off")
     sleep(1)

     GPIO.output(16, False)
     print("red on")
     sleep(1)
     GPIO.output(16, True)
     print("red off")
     sleep(1)


button_leds.py

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(11, GPIO.IN)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(12, GPIO.IN)
while 1:
        if GPIO.input(11):
                GPIO.output(13, False)
                print("red on")
        else:
                GPIO.output(13, True)
                print("red off")

        if GPIO.input(12):
                GPIO.output(15, False)
                print("green on")
        else:
                GPIO.output(15, True)
                print("green off")

I'd like to do a nice buttony volume control here using alsamixer, maybe even a 4 button up, down, playpause next control.

GPIO EXAMPLE HARDWARE

GPIO PIN GUIDE

3.3v 1 2 5v
I2C0 SDA 3 4 DNC
I2C0 SCL 5 6 GND
GPIO 4 7 8 UART TX
DNC 9 10 UART RX
GPIO 17 11 12 GPIO 18
GPIO 21 13 14 DNC
GPIO 22 15 16 GPIO 23
DNC 17 18 GPIO 24
SP10 MOSI 19 20 DNC
SP10 MISO 21 22 GPIO 25
SP10 SCLK 23 24 SP10 CE0 N
DNC 25 26 SP10 CE1 N

I need to update this now we have the B+ and a few more GPIO pins.

3.3v 1 2 5v
I2C0 SDA 3 4 DNC
I2C0 SCL 5 6 GND
GPIO 4 7 8 UART TX
DNC 9 10 UART RX
GPIO 17 11 12 GPIO 18
GPIO 21 13 14 DNC
GPIO 22 15 16 GPIO 23
DNC 17 18 GPIO 24
SP10 MOSI 19 20 DNC
SP10 MISO 21 22 GPIO 25
SP10 SCLK 23 24 SP10 CE0 N
DNC 25 26 SP10 CE1 N
27 28
29 30
31 32
33 34
35 36
37 38
39 40


...BACK<-->MORE...

 
    
© 2017 Outanet Ltd.