def main(window): wiringPy.setup(); for pin in range(0,8): wiringPy.pin_mode(pin, 1) curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_BLUE) curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_GREEN) curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_YELLOW) curses.init_pair(4, curses.COLOR_BLACK, curses.COLOR_RED) curses.curs_set(0) window.nodelay(True) window.clear() window.border(0) window.addstr(2, 2, "Raspberry Ladder VU meter") window.refresh() while window.getch() < 0: draw(window) window.refresh() time.sleep(0.05) window.clear() window.refresh()
#!/usr/bin/env python import wiringPy import time wiringPy.setup() for pin in range(0,8): wiringPy.pin_mode(pin, 1) wiringPy.digital_write_byte(255) print "whats your name?" name = raw_input() print "hello " + name doubles = [1,2,4,8,16,32,64,128] snooze = 0.1 while (True): for no in doubles: wiringPy.digital_write_byte(no) time.sleep(snooze) doubles.reverse() #for no in range (0,256): # wiringPy.digital_write_byte(no) # time.sleep(0.0625)
#!/usr/bin/env python import time import wiringPy if wiringPy.setup() < 0: print "Failed to initialize wiringPi" exit(-1) print "Rasberry Pi - Board revision:", wiringPy.board_revision() wiringPy.pin_mode(1, 2) for bright in range(0, 1024): wiringPy.pwm_write(1, bright) time.sleep(0.001) for bright in range(1024, -1, -1): wiringPy.pwm_write(1, bright) time.sleep(0.001) for pin in range(0, 8): wiringPy.pin_mode(pin, 1) for i in range(0, 256): wiringPy.digital_write_byte(i) time.sleep(0.02) wiringPy.digital_write_byte(0)
#!/usr/bin/env python import time import wiringPy if wiringPy.setup() < 0: print "Failed to initialize wiringPi" exit(-1) print "Rasberry Pi - Board revision:" , wiringPy.board_revision() wiringPy.pin_mode(1, 2) for bright in range(0, 1024): wiringPy.pwm_write(1, bright) time.sleep(0.001) for bright in range(1024, -1, -1): wiringPy.pwm_write(1, bright) time.sleep(0.001) for pin in range(0, 8): wiringPy.pin_mode(pin, 1) for i in range(0, 256): wiringPy.digital_write_byte(i) time.sleep(0.02) wiringPy.digital_write_byte(0)