예제 #1
0
	try:
		print "SSD1306 OLED Display Test"
		print "ROWS={0}, COLS={1}, I2C_ADDRESS={2}, I2C_PORT={3}".format(rows,cols,i2c_address,i2c_port)

		lcd = ssd1306_i2c(rows,cols,i2c_address,i2c_port)
		lcd.clear()
		lcd.message("pydPiper\nStarting",0,0,True)
		time.sleep(2)
		lcd.clear()

		starttime = time.time()
		elapsed = int(time.time()-starttime)
		timepos = time.strftime(u"%-M:%S", time.gmtime(int(elapsed))) + "/" + time.strftime(u"%-M:%S", time.gmtime(int(254)))

		dc = display.display_controller((cols,rows))
		f_path = os.path.join(os.path.dirname(__file__), '../pages_ssd1306.py')
		dc.load(f_path, db,dbp )

		starttime=time.time()
		while True:
			elapsed = int(time.time()-starttime)
			db['elapsed']=elapsed
			db['utc'] = moment.utcnow()
			processevent(events, starttime, 'pre', db, dbp)
			img = dc.next()
			processevent(events, starttime, 'post', db, dbp)
			lcd.update(img)
			time.sleep(.001)

예제 #2
0
	try:
		pins = [d4, d5, d6, d7]
		print "Winstar OLED Display Test"
		print "ROWS={0}, COLS={1}, RS={2}, E={3}, Pins={4} Delay Microseconds={5}".format(rows,cols,rs,e,pins,enable)

		lcd = winstar_weg(rows,cols,rs,e,[d4, d5, d6, d7],enable)
		lcd.clear()
		lcd.message("pydPiper\nStarting",0,0,True)
		time.sleep(2)
		lcd.clear()

		starttime = time.time()
		elapsed = int(time.time()-starttime)
		timepos = time.strftime(u"%-M:%S", time.gmtime(int(elapsed))) + "/" + time.strftime(u"%-M:%S", time.gmtime(int(254)))

		dc = display.display_controller((80,16))
		f_path = os.path.join(os.path.dirname(__file__), 'pages_test.py')
		dc.load(f_path, db,dbp )

		starttime=time.time()
		while True:
			elapsed = int(time.time()-starttime)
			db['elapsed']=elapsed
			db['utc'] = moment.utcnow()
			processevent(events, starttime, 'pre', db, dbp)
			img = dc.next()
			processevent(events, starttime, 'post', db, dbp)
			lcd.update(img)
			time.sleep(.1)

예제 #3
0
    def demo(self):

        db = {
                'actPlayer':'mpd',
                'playlist_position':1,
                'playlist_length':5,
                 'title':"Nicotine & Gravy",
                'artist':"Beck",
                'album':'Midnight Vultures',
                'elapsed':0,
                'length':400,
                'volume':50,
                'stream':'Not webradio',
                'utc':     moment.utcnow(),
                'outside_temp_formatted':'46\xb0F',
                'outside_temp_max':72,
                'outside_temp_min':48,
                'outside_conditions':'Windy',
                'system_temp_formatted':'98\xb0C',
                'state':'stop',
                'system_tempc':81.0
            }

        dbp = {
                'actPlayer':'mpd',
                'playlist_position':1,
                'playlist_length':5,
                 'title':"Nicotine & Gravy",
                'artist':"Beck",
                'album':'Midnight Vultures',
                'elapsed':0,
                'length':400,
                'volume':50,
                'stream':'Not webradio',
                'utc': moment.utcnow(),
                'outside_temp_formatted':'46\xb0F',
                'outside_temp_max':72,
                'outside_temp_min':48,
                'outside_conditions':'Windy',
                'system_temp_formatted':'98\xb0C',
                'state':'stop',
                'system_tempc':81.0
            }

        events = [
            (15, 'state', 'play'),
            (20, 'title', 'Mixed Bizness'),
            (30, 'volume', 80),
            (40, 'title', 'I Never Loved a Man (The Way I Love You)'),
            (40, 'artist', 'Aretha Franklin'),
            (40, 'album', 'The Queen Of Soul'),
            (70, 'state', 'stop'),
            (90, 'state', 'play'),
            (100, 'title', 'Do Right Woman, Do Right Man'),
            (120, 'volume', 100),
            (140, 'state', 'play' )
        ]

        starttime = time.time()
        elapsed = int(time.time()-starttime)
        timepos = time.strftime(u"%-M:%S", time.gmtime(int(elapsed))) + "/" + time.strftime(u"%-M:%S", time.gmtime(int(254)))

        dc = display.display_controller((80,16))
        f_path = os.path.join(os.path.dirname(__file__), 'pages_test.py')
        dc.load(f_path, db,dbp )

        starttime=time.time()
        while True:
            elapsed = int(time.time()-starttime)
            db['elapsed']=elapsed
            db['utc'] = moment.utcnow()
            self.processevent(events, starttime, 'pre', db, dbp)
            img = dc.next()
            self.processevent(events, starttime, 'post', db, dbp)
            lcd.update(img)
            time.sleep(.01)
예제 #4
0
        print "ROWS={0}, COLS={1}, RS={2}, E={3}, Pins={4} Delay Microseconds={5}".format(
            rows, cols, rs, e, pins, enable)

        lcd = winstar_weg(rows, cols, rs, e, [d4, d5, d6, d7], enable)
        lcd.clear()
        lcd.message("pydPiper\nStarting", 0, 0, True)
        time.sleep(2)
        lcd.clear()

        starttime = time.time()
        elapsed = int(time.time() - starttime)
        timepos = time.strftime(u"%-M:%S", time.gmtime(
            int(elapsed))) + "/" + time.strftime(u"%-M:%S",
                                                 time.gmtime(int(254)))

        dc = display.display_controller((80, 16))
        f_path = os.path.join(os.path.dirname(__file__), 'pages_test.py')
        dc.load(f_path, db, dbp)

        starttime = time.time()
        while True:
            elapsed = int(time.time() - starttime)
            db['elapsed'] = elapsed
            db['utc'] = moment.utcnow()
            processevent(events, starttime, 'pre', db, dbp)
            img = dc.next()
            processevent(events, starttime, 'post', db, dbp)
            lcd.update(img)
            time.sleep(.1)

    except KeyboardInterrupt: