コード例 #1
0
def cmdctrlled(pin,state):

    pin = int(pin)
    state = int(state)

    ## setup 
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(wP2board(pin),GPIO.OUT)

    ## set LED pin value
    GPIO.output(wP2board(pin),state)
コード例 #2
0
import RPi.GPIO as GPIO
from GPIOlib import wP2board
from time import sleep
import sys

SDI   = wP2board(0)   ## serial data input
RCLK  = wP2board(1)   ## memory clock input(STCP)
SRCLK = wP2board(2)   ## shift register clock input(SHCP)

SegCode = [0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x80]


def hc595_shift(dat):
	for i in range(0,8):
		GPIO.output(SDI, 0x80 & (dat << i))
		GPIO.output(SRCLK,GPIO.HIGH)
		sleep(0.001)
		GPIO.output(SRCLK,GPIO.LOW)

	GPIO.output(RCLK,GPIO.HIGH)
	sleep(0.001)
	GPIO.output(RCLK,GPIO.LOW)

## Inititalize

print 'GPIO.VERSION:', GPIO.VERSION

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup([SDI,RCLK,SRCLK],GPIO.OUT)   ## make pins output
コード例 #3
0
def led_off(wPpin):
    try:
        GPIO.output(wP2board(wPpin), GPIO.HIGH)
    except:
        pass
コード例 #4
0
def led_on(wPpin):
    try:
        GPIO.output(wP2board(wPpin), GPIO.LOW)
    except:
        pass
コード例 #5
0
ファイル: 06_rgb.py プロジェクト: manmohanpv/superkit_B_plus
import RPi.GPIO as GPIO
from GPIOlib import wP2board
from time import sleep
import sys

RED_PIN = wP2board(0)
GREEN_PIN = wP2board(1)
BLUE_PIN = wP2board(2)
PAUSE = 0.500

if __name__ == '__main__':

	def led_color_set(red_value,green_value,blue_value):
	## Convert HEX to decimal percent

		red_percent = (int(red_value,16)*100/255)
		green_percent = (int(green_value,16)*100/255)
		blue_percent = (int(blue_value,16)*100/255)
	
		red.ChangeDutyCycle(red_percent)
		green.ChangeDutyCycle(green_percent)
		blue.ChangeDutyCycle(blue_percent)

	## setup 
	GPIO.setwarnings(False)
	GPIO.setmode(GPIO.BOARD)
	GPIO.setup(RED_PIN,GPIO.OUT)
	GPIO.setup(GREEN_PIN,GPIO.OUT)
	GPIO.setup(BLUE_PIN,GPIO.OUT)

	## LED init
コード例 #6
0
        GPIO.output(wP2board(wPpin), GPIO.LOW)
    except:
        pass


def led_off(wPpin):
    try:
        GPIO.output(wP2board(wPpin), GPIO.HIGH)
    except:
        pass


## setup

led_count = 5
btn_pin = wP2board(5)

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BOARD)

for i in range(0, led_count):
    GPIO.setup(wP2board(i), GPIO.OUT, initial=GPIO.HIGH)
GPIO.setup(btn_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)


## led test
def led_test():

    for i in range(led_count - 1, -1, -1):  ## led_count-1 to 0
        led_off(i)
コード例 #7
0
ファイル: photoboof.py プロジェクト: dashdrum/photoboof
def led_off(wPpin):
    try:
        GPIO.output(wP2board(wPpin),GPIO.HIGH)
    except:
        pass
コード例 #8
0
ファイル: photoboof.py プロジェクト: dashdrum/photoboof
def led_on(wPpin):
    try:
        GPIO.output(wP2board(wPpin),GPIO.LOW)
    except:
        pass
コード例 #9
0
ファイル: photoboof.py プロジェクト: dashdrum/photoboof
ALBUM = None
GROUP = None
EVENT = 'Just Having Photoboof Phun'
FILE_PATH = 'pics/'
MONTAGE_PATH = FILE_PATH + 'montages/'
UPLOADED_PATH = FILE_PATH + 'uploaded/'
GIF_DELAY = 50
PHOTO_COUNT = 4

led_count = 5
ready_led = 0
pose_led = 1
take_led = 2
processing_led = 3
flash_led = 4
btn_pin = wP2board(5)
btn2_pin = wP2board(6)

# Power up

display = Display()
display.show_image('splash1.png')
sleep(1.000)
display.show_image('splash2.png')
sleep(1.000)
display.show_image('splash3.png')
sleep(1.000)
display.show_image('splash4.png')
sleep(1.000)

# GPIO Setup
コード例 #10
0
ファイル: 03_8Led.py プロジェクト: manmohanpv/superkit_B_plus
    def draw_array():
        for i in range(0,len(array)):
	    GPIO.output(wP2board(i),array[i])
コード例 #11
0
ファイル: 03_8Led.py プロジェクト: manmohanpv/superkit_B_plus
def led_off(wPpin):
    try:
        GPIO.output(wP2board(wPpin),GPIO.HIGH)
    except:
        pass

## setup 

led_count = 8

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BOARD)

for i in range(0,led_count):
    GPIO.setup(wP2board(i),GPIO.OUT, initial=GPIO.HIGH)

## Back n forth

print "Back and forth"

for runcount in range(0,3):

    for i in range(0,led_count):  ## 0 to led_count-1
        led_on(i)
        sleep(0.100)
        led_off(i)
    ## sleep(0.500)
    for i in range(led_count-1,-1,-1): ## led_count-1 to 0
        led_on(i)
        sleep(0.100)