示例#1
0
文件: eyes.py 项目: adum/RobotMan
class EyeChanger():
    def __init__(self):
        self.grid = EightByEight(address=0x70)
        self.pixels = {}
        
    def eye_data(self, name, pixels):
        self.pixels[name] = pixels

    def show_eye(self, name):
        p = self.pixels[name]
        self.grid.clear()
        i = 0
        for x in range(0, 8):
            for y in range(0, 8):
                if p[i] == '1':
                    self.grid.setPixel(x, y)
                i = i + 1
#!/usr/bin/python

import time
import datetime
from Adafruit_8x8 import EightByEight

# ===========================================================================
# 8x8 Pixel Example
# ===========================================================================
grid = EightByEight(address=0x70)

print("Press CTRL+Z to exit")

# Continually update the 8x8 display one pixel at a time
while(True):
  for x in range(0, 8):
    for y in range(0, 8):
      grid.setPixel(x, y)
      time.sleep(0.05)
  time.sleep(0.5)
  grid.clear()
  time.sleep(0.5)
示例#3
0
#!/usr/bin/python

import time
import datetime
from Adafruit_8x8 import EightByEight

# source: https://github.com/pdp7/beaglebackpack/blob/master/README.md
# ===========================================================================
# 8x8 Pixel Example
# ===========================================================================
grid = EightByEight(address=0x70)
grid2 = EightByEight(address=0x71)

print "Press CTRL+Z to exit"

# Continually update the 8x8 display one pixel at a time
while (True):
    for x in range(0, 8):
        for y in range(0, 8):
            grid.setPixel(x, y)
            grid2.setPixel(x, y)
            time.sleep(0.1)
    time.sleep(0.5)
    grid.clear()
    grid2.clear()
    time.sleep(0.5)
from glcdfont import glcdfont
from Adafruit_8x8 import EightByEight

grid1 = EightByEight(address=0x70)
grid2 = EightByEight(address=0x71)
grid3 = EightByEight(address=0x72)
grid1.setBrightness(8)
grid2.setBrightness(8)
grid3.setBrightness(8)
font = glcdfont().getfont()

#print(font)
grid1.fillScreen()
grid1.writeDisplay()
time.sleep(.25)
grid1.clear()

grid2.fillScreen()
grid2.writeDisplay()
time.sleep(.25)
grid2.clear()

grid3.fillScreen()
grid3.writeDisplay()
time.sleep(.25)
grid3.clear()

for i in range (0, 24):
    grid1.drawLine(7,7-i,0,-16+i)
    grid2.drawLine(7,15-i,0,-8+i)
    grid3.drawLine(7,23-i,0,0+i)
示例#5
0
        nextThreeE3 = sorted([
            str(buses['timeToStation'] / 60)
            for buses in data if buses['lineId'] == 'e3'
        ],
                             key=int)[:3]
        nextTwo440 = sorted([
            str(buses['timeToStation'] / 60)
            for buses in data if buses['lineId'] == '440'
        ],
                            key=int)[:2]
        nextOneN11 = sorted([
            str(buses['timeToStation'] / 60)
            for buses in data if buses['lineId'] == 'N11'
        ],
                            key=int)[:1]
        lhs.clear()
        rhs.clear()
        ypos = 0
        if len(nextThreeE3) > 0:
            for ymod, wait in enumerate(nextThreeE3):
                printToMatrix(lhs, wait, ypos)
                ypos += (6 - ymod)
        ypos = 0
        if len(nextTwo440) > 0:
            for ymod, wait in enumerate(nextTwo440):
                printToMatrix(rhs, wait, ypos)
                ypos += (6 - ymod)
        if len(nextOneN11) > 0: printToMatrix(rhs, nextOneN11.pop(), 11, 1)
    except:
        print >> stderr, 'Ooops Python Threw-up, handling and restarting loop...'
示例#6
0
from glcdfont import glcdfont
from Adafruit_8x8 import EightByEight

grid1 = EightByEight(address=0x70)
grid2 = EightByEight(address=0x71)
grid3 = EightByEight(address=0x72)
grid1.setBrightness(8)
grid2.setBrightness(8)
grid3.setBrightness(8)
font = glcdfont().getfont()

#print(font)
grid1.fillScreen()
grid1.writeDisplay()
time.sleep(.25)
grid1.clear()

grid2.fillScreen()
grid2.writeDisplay()
time.sleep(.25)
grid2.clear()

grid3.fillScreen()
grid3.writeDisplay()
time.sleep(.25)
grid3.clear()

for i in range(0, 24):
    grid1.drawLine(7, 7 - i, 0, -16 + i)
    grid2.drawLine(7, 15 - i, 0, -8 + i)
    grid3.drawLine(7, 23 - i, 0, 0 + i)