def setup(self, config):
        MenuOption.setup(self, config)
        
        self.whitelist = self.getWhitelist(config)
        self.blacklist = self.getBlacklist(config)
        self.whitelist_status = self.getWhitelistStatus(config)
        self.blacklist_status = self.getBlacklistStatus(config)

        lcd.create_char(0, [0, 4, 14, 0, 0, 14, 4, 0])  # Up down arrow

        # init webclient
        self.webclient = Webclient(config)
        
        # get the modules as JSON
	complete_modules = self.getModules()
	
        for line in complete_modules:
            if self.whitelist:
                if line in self.whitelist:
                    self.modules.append(line)
            else:
                self.modules.append(line)
          
            if self.blacklist_status:
                if line in self.blacklist and line in self.modules:
                    self.modules.remove(line)

	self.ready = True
    def setup(self, config):
        MenuOption.setup(self, config)
        
        self.whitelist = self.getWhitelist(config)
        self.blacklist = self.getBlacklist(config)
        self.whitelist_status = self.getWhitelistStatus(config)
        self.blacklist_status = self.getBlacklistStatus(config)

        lcd.create_char(0, [0, 4, 14, 0, 0, 14, 4, 0])  # Up down arrow

        # init webclient
        self.webclient = Webclient(config)
        
        # get the modules as JSON
	complete_modules = self.getModules()
	
        for line in complete_modules:
            if self.whitelist:
                if line in self.whitelist:
                    self.modules.append(line)
            else:
                self.modules.append(line)
          
            if self.blacklist_status:
                if line in self.blacklist and line in self.modules:
                    self.modules.remove(line)

	self.ready = True
Beispiel #3
0
	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)
	timestamp = time.mktime(deploy.timetuple())
	deploy_utc = datetime.utcfromtimestamp(timestamp)
	elapsed = deploy_utc - datetime.utcnow()	
	trunc_micros = timedelta(days=elapsed.days, seconds=elapsed.seconds) 
	seconds = elapsed.days*86400 + elapsed.seconds
	minutes, seconds = divmod(seconds, 60)
	hours, minutes = divmod(minutes, 60)
	lcd.write(("{hours:02d}:{minutes:02d}:{seconds:02d}".format(**vars())))
         sys.exit()
     elif command == 'reset':
         lcd.clear()
         backlight.off()
         backlight.set_graph(0.0)
 elif component == 'LCD':
     if command == 'clear':
         lcd.clear()
     elif command == 'setContrast':
         lcd.set_contrast(parameters['contrast'])
     elif command == 'setCursorPosition':
         lcd.set_cursor_position(parameters['column'], parameters['row'])
     elif command == 'write':
         lcd.write(parameters['value'])
     elif command == 'createCharacter':
         lcd.create_char(parameters['memoryPosition'], parameters['map'])
     elif command == 'writeCharacter':
         lcd.write(chr(parameters['memoryPosition']))
 elif component == 'Backlight':
     if command == 'turnOff':
         backlight.off()
     elif command == 'useRBGMode':
         backlight.use_rbg()
     elif command == 'setBrightnessOfLed':
         backlight.set(parameters['ledIndex'], parameters['brightness'])
     elif command == 'setToHue':
         backlight.hue(parameters['hue'])
     elif command == 'setLeftToHue':
         backlight.left_hue(parameters['hue'])
     elif command == 'setMiddleToHue':
         backlight.mid_hue(parameters['hue'])
         sys.exit()
     elif command == 'reset':
         lcd.clear()
         backlight.off()
         backlight.set_graph(0.0)
 elif component == 'LCD':
     if command == 'clear':
         lcd.clear()
     elif command == 'setContrast':
         lcd.set_contrast(parameters['contrast'])
     elif command == 'setCursorPosition':
         lcd.set_cursor_position(parameters['column'], parameters['row'])
     elif command == 'write':
         lcd.write(parameters['value'])
     elif command == 'createCharacter':
         lcd.create_char(parameters['memoryPosition'], parameters['map'])
     elif command == 'writeCharacter':
         lcd.write(chr(parameters['memoryPosition']))
 elif component == 'Backlight':
     if command == 'turnOff':
         backlight.off()
     elif command == 'useRBGMode':
         backlight.use_rbg()
     elif command == 'setBrightnessOfLed':
         backlight.set(parameters['ledIndex'], parameters['brightness'])
     elif command == 'setToHue':
         backlight.hue(parameters['hue'])
     elif command == 'setLeftToHue':
         backlight.left_hue(parameters['hue'])
     elif command == 'setMiddleToHue':
         backlight.mid_hue(parameters['hue'])
Beispiel #6
0
#	0b00000,
#	0b00000,
#	0b01110,
#	0b10001,
#	0b11111,
#	0b10000,
#	0b01110]

r = [[0b00000, 0b10110, 0b11001, 0b10000, 0b10000, 0b10000, 0b00000, 0b00000],
     [0b00000, 0b00000, 0b10110, 0b11001, 0b10000, 0b10000, 0b10000, 0b00000],
     [0b00000, 0b00000, 0b00000, 0b10110, 0b11001, 0b10000, 0b10000, 0b10000],
     [0b00000, 0b00000, 0b10110, 0b11001, 0b10000, 0b10000, 0b10000, 0b00000],
     [0b00000, 0b10110, 0b11001, 0b10000, 0b10000, 0b10000, 0b00000, 0b00000],
     [0b10110, 0b11001, 0b10000, 0b10000, 0b10000, 0b00000, 0b00000, 0b00000]]

lcd.create_char(4, black)

#lcd.create_char(5,m)
#lcd.create_char(6,r)
#lcd.create_char(7,n)

line0 = chr(4) + chr(5) + 'a' + chr(7) + 'i' + 'c' + chr(4) * 2 + chr(
    5) + 'i' + chr(7) + 'e' + chr(6) + chr(4) * 2
line1 = chr(0) + chr(1) + chr(4) * 13
line2 = chr(2) + chr(3) + chr(4) * 13

top_left = [[
    ~0b00000, ~0b00011, ~0b00111, ~0b00011, ~0b00011, ~0b00011, ~0b00001,
    ~0b00011
],
            [
Beispiel #7
0
import time

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)
Beispiel #8
0
    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)

    if hue > 1.0:
        hue = 0.0

    lcd.create_char(0, getAnimFrame(char, 4))
    lcd.create_char(1, getAnimFrame(arr, 16))
    lcd.create_char(2, getAnimFrame(raa, 8))
    lcd.create_char(3, getAnimFrame(pirate, 2))
    lcd.create_char(4, getAnimFrame(heart, 4))
    lcd.create_char(5, getAnimFrame(pacman, 3))
    lcd.set_cursor_position(0, 1)
    t = datetime.datetime.now().strftime("%H:%M:%S.%f")
    lcd.write(t)

    time.sleep(0.005)
Beispiel #9
0
from threading import Thread

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)
Beispiel #10
0
    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)

    if hue > 1.0:
        hue = 0.0

    lcd.create_char(0, getAnimFrame(char, 4))
    lcd.create_char(1, getAnimFrame(arr, 16))
    lcd.create_char(2, getAnimFrame(raa, 8))
    lcd.create_char(3, getAnimFrame(pirate, 2))
    lcd.create_char(4, getAnimFrame(heart, 4))
    lcd.create_char(5, getAnimFrame(pacman, 3))
    lcd.set_cursor_position(0, 1)
    t = datetime.datetime.now().strftime("%H:%M:%S.%f")
    lcd.write(t)

    time.sleep(0.005)
Beispiel #11
0
	def __init__(self, line):
		self.line = line
		clock = [
			[0xff,0x0a,0x0a,0x04,0x04,0x0a,0xee,0xff]
		]
		lcd.create_char(1, getAnimFrame(clock, 3))
Beispiel #12
0
			
class Time:
	def __init__(self, line):
		self.line = line
		clock = [
			[0xff,0x0a,0x0a,0x04,0x04,0x0a,0xee,0xff]
		]
		lcd.create_char(1, getAnimFrame(clock, 3))
		
	def show(self):
		lcd.set_cursor_position(0, self.line)
		t = datetime.datetime.now().strftime(" %d/%m %H:%M:%S")
		lcd.write(chr(1) + t)

lcd.clear()
lcd.write(chr(0) + myIP)

colour = Colour()
light = Light()
message = Message(line = 2)
_time = Time(line = 1)

while True:
	lcd.create_char(0, getAnimFrame(heart, 4))
	
	_time.show()
	colour.animate()
	light.animate()
	message.animate()
	
	time.sleep(0.1)
Beispiel #13
0
    7: [1, 2, 0, 5, 0, 6],
    8: [3, 2, 3, 2, 1, 1],
    9: [3, 2, 1, 2, 1, 1],
    'dot': [7, 7, 0],
    'empty': [0, 0, 0],
}

# setup character
from dot3k import lcd, backlight
from datetime import datetime
import time

backlight.rgb(61, 255, 129)
lcd.set_contrast(45)
lcd.set_display_mode(True, False, False)
lcd.create_char(0, [0, 0, 0, 0, 0, 0, 0, 0])
lcd.create_char(1, segone)
lcd.create_char(2, segtwo)
lcd.create_char(3, segthree)
lcd.create_char(4, segfour)
lcd.create_char(5, segfive)
lcd.create_char(6, segsix)
lcd.create_char(7, segdot)

lcd.clear()
running = True
tick = False
while running:
    now = datetime.now()
    second = 'dot' if tick else 'empty'
    tick = not tick