Пример #1
0
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
      #   NS_object_string = "X68abccccccZ"

      #   Jupiter
      #if (row == 7):
      #   NS_object_string = "X78aaaaaaabc"

      #   Saturn
      #if (row == 8):
      #   NS_object_string = "X88ccbaaaaaa"

      #print "row, string", row, NS_object_string
            
      for col in range (0,8):
         char = NS_object_string[col+3]
         if (char=='a'):
             grid.setPixel(row,7-col,0)
         if (char=='b'):
             grid.setPixel(row,7-col,1)
         if (char=='c'):
             grid.setPixel(row,7-col,1)
         if (char=='g'):
             flash(row,col,1,ticks)
         if (char=='h'):
             flash(row,col,2,ticks)
         if (char=='i'):
             flash(row,col,3,ticks)
         if (char=='j'):
             flash(row,col,4,ticks)
         if (char=='k'):
             flash(row,col,5,ticks)
         if (char=='l'):
Пример #4
0
#!/usr/bin/python
#
# Tiny boat for Adafruit 8x8 LED Backpack
#
# (C) 2014 PiClass - BSD License
#
from Adafruit_8x8 import EightByEight
grid = EightByEight(address=0x70)
 
# Clear the grid
grid.clear()

# Switch on leds
grid.setPixel(0, 5)
grid.setPixel(0, 7)

grid.setPixel(1, 4)
grid.setPixel(1, 5)
grid.setPixel(1, 6)

grid.setPixel(2, 2)
grid.setPixel(2, 4)
grid.setPixel(2, 5)

grid.setPixel(3, 3)
grid.setPixel(3, 4)
grid.setPixel(3, 5)

grid.setPixel(4, 3)
grid.setPixel(4, 4)
grid.setPixel(4, 5)
Пример #5
0
#!/usr/bin/python
#
# Tiny boat for Adafruit 8x8 LED Backpack
#
# (C) 2014 PiClass - BSD License
#
from Adafruit_8x8 import EightByEight

grid = EightByEight(address=0x70)

# Clear the grid
grid.clear()

# Switch on leds
grid.setPixel(0, 5)
grid.setPixel(1, 5)
grid.setPixel(1, 6)
grid.setPixel(2, 5)
grid.setPixel(2, 6)
grid.setPixel(2, 7)
grid.setPixel(3, 5)
grid.setPixel(3, 6)
grid.setPixel(3, 7)
grid.setPixel(4, 5)
grid.setPixel(4, 6)
grid.setPixel(4, 7)
grid.setPixel(5, 5)
grid.setPixel(5, 6)
grid.setPixel(5, 7)
grid.setPixel(6, 5)
grid.setPixel(6, 6)
Пример #6
0
#!/usr/bin/python
#
# Simple smiley for Adafruit 8x8 LED Backpack
#
# (C) 2014 PiClass - BSD License
#
from Adafruit_8x8 import EightByEight

grid = EightByEight(address=0x70)

# Clear the grid
grid.clear()

# Switch on leds line by line
grid.setPixel(0, 2)
grid.setPixel(0, 3)
grid.setPixel(0, 4)
grid.setPixel(0, 5)

grid.setPixel(1, 1)
grid.setPixel(1, 6)

grid.setPixel(2, 0)
grid.setPixel(2, 2)
grid.setPixel(2, 4)
grid.setPixel(2, 7)

grid.setPixel(3, 0)
grid.setPixel(3, 5)
grid.setPixel(3, 7)
Пример #7
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)
Пример #8
0
#!/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, 7-y)
      time.sleep(0.05)
  time.sleep(0.5)
  grid.clear()
  time.sleep(0.5)
Пример #9
0
#!/usr/bin/python

import time

from Adafruit_8x8 import EightByEight

# ===========================================================================
# 8x8 Pixel Example
# ===========================================================================
grid1 = 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):
            grid1.setPixel(x, y)
            grid2.setPixel(x, y)
            time.sleep(0.05)
    time.sleep(0.5)
    grid1.clear()
    grid2.clear()
    time.sleep(0.5)
Пример #10
0
print "Press CTRL+C to exit"

# Continually update the current unseen notification count on a 4 char, 7-segment display
while (True):
    grid.clear()
    graph = facebook.GraphAPI(access_token)
    notifications = graph.get_object("me/notifications")
    print "notifications"
    print notifications
    summary = notifications['summary']
    if summary:
        num = summary['unseen_count']
        print num
        min = 0
        max = 8
        fullRows = 0

        for n in range(0, 8):
            if num > min and num <= max:
                for y in range(0, 8):
                    for x in range(0, fullRows):
                        grid.setPixel(x, y)
                for y in range(0, num - min):
                    grid.setPixel(fullRows, y)
            min += 8
            max += 8
            fullRows += 1

    time.sleep(60)
Пример #11
0
print "Press CTRL+C to exit"

# Continually update the current unseen notification count on a 4 char, 7-segment display
while(True):
  grid.clear()
  graph = facebook.GraphAPI(access_token)
  notifications  = graph.get_object("me/notifications")
  print "notifications"
  print notifications
  summary = notifications['summary']
  if summary:
    num = summary['unseen_count']
    print num
    min=0
    max=8
    fullRows=0

    for n in range(0, 8):
      if num > min and num <= max:
        for y in range(0, 8):
	  for x in range(0, fullRows):
            grid.setPixel(x, y)
        for y in range(0, num-min):
          grid.setPixel(fullRows, y)
      min+=8
      max+=8
      fullRows+=1

  time.sleep(60)