Example #1
0
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()
Example #2
0
    def initDevice(self):
        """Initialise the screen"""
        wiringPy.debug(0)

        if wiringPy.setup_gpio() != 0:
            raise IOError("Failed to initialize wiringPy properly")

        fd = wiringPy.setup_bitbang(self._CS, self._SDATA, self._SCLK, 0)
        if fd == -1:
            raise IOError("Failed to initialize bitbang properly")

        pins = [self._SDATA, self._SCLK, self._RST, self._CS]
        map(lambda p: wiringPy.pin_mode(p, ON), pins)

        # Reset the device
        self.reset()

        #Exit LCD sleep mode
        self.__spiInterface.command(0x11)

        #Turns on Booster voltage
        self.__spiInterface.command(0x03)
       
        #Display inversion ON 
        self.__spiInterface.command(0x21)
        
        #Set LCD params: 
        self.__spiInterface.command(0x36)
        self.__spiInterface.sData(0xC8)
        
        #Set pixel format
        self.__spiInterface.command(0x3A)

        #Set Contrast
        self.setContrast()	

        #Clear All pixels
        #self.__spiInterface.command(0x22) 

        #Display on
        self.ON()

        #Set to no operation
        self.__spiInterface.command(0x00)
Example #3
0
def init(CLK = 11, DIN = 10, DC = 23, RST = 24, LIGHT = 18, CE = 8, contrast = default_contrast):
    """ init screen, clearscreen """
    wiringPy.debug(0)

    if wiringPy.setup_gpio() != 0:
        raise IOError("Failed to initialize wiringPy properly")

    fd = wiringPy.setup_bitbang(CE, DIN, CLK, 0)
    if fd == -1:
        raise IOError("Failed to initialize bitbang properly")

    pins = [CLK, DIN, DC, RST, LIGHT, CE]
    pin_CLK, pin_DIN, pin_DC, pin_RST, pin_LIGHT, pin_CE = pins
    list(map(lambda p: wiringPy.pin_mode(p, ON), pins))

    # Reset the device
    wiringPy.digital_write(pin_RST, OFF)
    time.sleep(0.1)
    wiringPy.digital_write(pin_RST, ON)
    set_contrast(contrast)
    cls()
Example #4
0
#!/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)