Exemplo n.º 1
0
def show_follower_count(pin):
    try:
        followers = twitter.follower_count()
        msg = "You have %-6i followers" % followers
    except:
        msg = "Twitter API     limit reached"

    backlight.sweep(random())
    lcd.clear()
    lcd.write(msg)
Exemplo n.º 2
0
	[0x1f,0x1f,0x1b,0x1b,0x1f,0x1f,0x18,0x18], #P
	[0x1f,0x1f,0x1b,0x1b,0x1f,0x1f,0x1a,0x19], #R
	[0x1f,0x1f,0xe,0xe,0xe,0xe,0x1f,0x1f], #I
	[0x1e,0x1f,0x1b,0x1b,0x1b,0x1b,0x1f,0x1e], #D
	[0x1f,0x1f,0x18,0x1e,0x1e,0x18,0x1f,0x1f] #E
] #WHADDOESTHATSPELL??  Pride!

def getAnimFrame(char,fps):
	return char[ int(round(time.time()*fps) % len(char)) ]

cpu_sample_count = 200
cpu_samples = [0] * cpu_sample_count
hue = 0.0
while True:
	hue += 0.008
	backlight.sweep(hue)

	cpu_samples.append(psutil.cpu_percent() / 100.0)
	cpu_samples.pop(0)

	cpu_avg = sum(cpu_samples) / cpu_sample_count
	backlight.set_graph(cpu_avg)

	lcd.create_char(0,getAnimFrame(eqlchar,2))

	if hue > 1.0:
		hue = 0.0

	lcd.set_cursor_position(0,1)
	t = datetime.now().strftime("%H:%M:%S.%f")
	deploy = datetime(2015, 7, 1, 0, 0)
Exemplo n.º 3
0
        [0x00,0x1f,0x16,0x06,0x00,0x08,0x03,0x1e],
        [0x00,0x1f,0x0b,0x03,0x00,0x04,0x11,0x1f],
        [0x00,0x1f,0x05,0x01,0x00,0x02,0x08,0x07]
]

def get_anim_frame(anim, fps):
  return anim[ int(round(time.time()*fps) % len(anim)) ]

lcd.set_cursor_position(1,0)
lcd.write('Display-o-tron')
lcd.write('      ' + chr(0) + '3000  ')
lcd.create_char(0,get_anim_frame(pirate,4))



while 1:
  backlight.rgb(255,0,0)
  time.sleep(1)
  backlight.rgb(0,255,0)
  time.sleep(1)
  backlight.rgb(0,0,255)
  time.sleep(1)
  backlight.rgb(255,255,255)
  time.sleep(1)
  for i in range(0,360):
    backlight.hue(i/360.0)
    time.sleep(0.01)
  for i in range(0,360):
    backlight.sweep(i/360.0)
    time.sleep(0.01)
Exemplo n.º 4
0
pirate = [[0x00, 0x1f, 0x0b, 0x03, 0x00, 0x04, 0x11, 0x1f],
          [0x00, 0x1f, 0x16, 0x06, 0x00, 0x08, 0x03, 0x1e],
          [0x00, 0x1f, 0x0b, 0x03, 0x00, 0x04, 0x11, 0x1f],
          [0x00, 0x1f, 0x05, 0x01, 0x00, 0x02, 0x08, 0x07]]


def get_anim_frame(anim, fps):
    return anim[int(round(time.time() * fps) % len(anim))]


lcd.set_cursor_position(1, 0)
lcd.write('Display-o-tron')
lcd.write('      ' + chr(0) + '3000  ')
lcd.create_char(0, get_anim_frame(pirate, 4))

while 1:
    backlight.rgb(255, 0, 0)
    time.sleep(1)
    backlight.rgb(0, 255, 0)
    time.sleep(1)
    backlight.rgb(0, 0, 255)
    time.sleep(1)
    backlight.rgb(255, 255, 255)
    time.sleep(1)
    for i in range(0, 360):
        backlight.hue(i / 360.0)
        time.sleep(0.01)
    for i in range(0, 360):
        backlight.sweep(i / 360.0)
        time.sleep(0.01)
Exemplo n.º 5
0
#!/usr/bin/env python
import dot3k.lcd as lcd
import dot3k.backlight as backlight
import time, datetime, copy, math, psutil

cpu_sample_count = 200
cpu_samples = [0] * cpu_sample_count

hue = 0.0

while True:
    hue += 0.001
    backlight.sweep(hue)

    cpu_samples.append(psutil.cpu_percent() / 100.0)
    cpu_samples.pop(0)

    cpu_avg = sum(cpu_samples) / cpu_sample_count
    backlight.set_graph(cpu_avg)

    #cpu = psutil.cpu_percent(interval=0, percpu=False)
    cake = int(cpu_avg)
    #backlight.rgb(0,125,200)

    if hue > 1.0:
        hue = 0.0

    lcd.set_cursor_position(0, 0)
    useage = str(cpu_avg * 100)
    lcd.write('CPU: ' + useage)