Exemplo n.º 1
0
class Animation(object):
	"""Feed this object with 'frames' as pacman and ghost in smiley.py"""
	def __init__(self, frames):
		self.frames = frames
		self.frame_counter = 0

	def up(self):
		self.frame_counter = (self.frame_counter + 1) % len(self.frames)
		return self.frames[self.frame_counter]


if __name__ == '__main__':
	import smiley
	from time import sleep

	from rpstomp import EightByEightPlus
    grid = EightByEightPlus(address=0x70, brightness=0)

	animation1 = Animation(smiley.pacman)
	animation2 = Animation(smiley.ghost)
	for i in range(10):
		frame = animation1.up()
		grid.grid_array(frame)		
		sleep(0.1)
	for i in range(10):
		frame = animation2.up()
		grid.grid_array(frame)		
		sleep(0.1)
Exemplo n.º 2
0
#!/usr/bin/python

import time
import datetime
from rpstomp import EightByEightPlus
from scroller import Scroller
        

pos = 0
grid = EightByEightPlus(address=0x70, brightness=0)

scroller = Scroller()

while(True):
    pos += 1

    grid.bytes_array(scroller.up())

    time.sleep(0.1)
Exemplo n.º 3
0
#!/usr/bin/python

from rpstomp import SevenSegmentPlus
from rpstomp import EightByEightPlus
import smiley
from time import sleep

grid = EightByEightPlus(address=0x70, brightness=0)
segment = SevenSegmentPlus(address=0x74, brightness=0)

segment.write('bye ')
grid.grid_array(smiley.smiley_cry)

cycle = [1,2,4,8,16,32]
cycle_counter = 0

# Display animation while shutting down.
print 'Bye...'
while True:
    segment.writeDigitRaw(4, cycle[cycle_counter])
    cycle_counter = (cycle_counter + 1) % len(cycle)
    sleep(0.2)