Exemple #1
0
    def __init__(self):

        # Clear the screen and set the contrast
        lcd.clear()
        lcd.set_contrast(20)  # Tested a bunch of contrasts 20 seems the best

        GPIO.setmode(GPIO.BCM)
        GPIO.setup(5, GPIO.OUT)
        GPIO.setup(6, GPIO.OUT)
        GPIO.setup(13, GPIO.OUT)
        if command == 'kill':
            if parameters['performReset']:
                lcd.clear()
                backlight.off()
                backlight.set_graph(0.0)

            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'])
Exemple #3
0
  lcd.clear()
  print("Exiting kubernetes status server")
  sys.exit(0)

########################
# Entry point here
########################

print("Kubernetes status server starting")
config.load_kube_config()
v1 = client.CoreV1Api()
v1Apps = client.AppsV1Api()

backlight.off()
lcd.clear()
lcd.set_contrast(45)

signal.signal(signal.SIGINT, cleanUp)

# Switch modes with joystick
@joystick.on(joystick.UP)
def handle_u(pin):
  switchMode(pin)
@joystick.on(joystick.DOWN)
def handle_d(pin):
  switchMode(pin)
@joystick.on(joystick.LEFT)
def handle_l(pin):
  switchMode(pin)    
@joystick.on(joystick.RIGHT)
def handle_r(pin):
Exemple #4
0
#!/usr/bin/env python

import fcntl
import socket
import struct
import time
import os
import sys
import dot3k.lcd as lcd
import dot3k.backlight as backlight
import dot3k.joystick as nav
import psutil

#Clears the LCD and sets contrast on Start
lcd.clear()
lcd.set_contrast(47)


#Function to get CPU Temp
def getCPUtemperature():
    res = os.popen('vcgencmd measure_temp').readline()
    return (res.replace("temp=", "").replace("'C\n", ""))


#Function to get CPU Usage
def getCPUuse():
    return(str(os.popen("top -n1 | awk '/Cpu\(s\):/ {print $2}'").readline().strip(\
)))


#The Button press turns the backlight on and off.
     if command == 'kill':
         if parameters['performReset']:
             lcd.clear()
             backlight.off()
             backlight.set_graph(0.0)
         
         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'])
Exemple #6
0
import time
from threading import Thread, Lock

from gpiozero import RGBLED, Buzzer

from dot3k import lcd
from interface_strings import *

import locale
locale.setlocale(locale.LC_ALL, display_locale)

lcd.set_display_mode()
lcd.set_contrast(20)

backlight = RGBLED(5, 6, 13)

buzzer = Buzzer(22)

message_lock = Lock()

terminal_enabled = 0
terminal_message = ""
terminal_amount = 0

lcd.create_animation(7, [[0b00000,0b10001,0b01010,0b00100,0b10001,0b01010,0b00100,0b00000],[0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000]], 1)

def _idle():
    while 1:
        if message_lock.locked() == False:
            lcd.clear()
            if terminal_enabled != True:
Exemple #7
0
        @nav.on(nav.LEFT)
        def handle_left(pin):
            menu.left()

        @nav.on(nav.RIGHT)
        def handle_right(pin):
            menu.right()

        @nav.on(nav.BUTTON)
        def handle_button(pin):
            menu.select()

    backlight.set_graph(0)
    backlight.rgb(BG_R, BG_G, BG_B)
    lcd.set_contrast(50)

    while True:
        # status = mpd_client.status()
        #
        # lcd.set_cursor_position(0, 0)
        # if status['state'] == 'play' or status['state'] == 'pause':
        #     current_song = mpd_client.currentsong()
        #
        #     lcd.write(get_trimmed_string(current_song['title']).center(16))
        #     lcd.write(' '.center(16))
        #     lcd.write(' '.center(16))
        # else:
        #     lcd.write(' '.center(16))
        #     lcd.write('Ready'.center(16))
        #     lcd.write(' '.center(16))
lcd.set_cursor_position(0, 0)
lcd.write("IP:" + ip)

lcd.set_cursor_position(0, 1)
lcd.write("CPU: ")

lcd.set_cursor_position(13, 1)
lcd.write("IMG")

cpu_sample_count = 200
cpu_samples = [0] * cpu_sample_count
hue = 0.0


lcd.set_contrast(52)

backlight.rgb(200, 200, 200)


camera = picamera.PiCamera();

while True:
    cpu_samples.append(psutil.cpu_percent() / 100.0)
    cpu_samples.pop(0)

    cpu_avg = sum(cpu_samples) / cpu_sample_count

    #turns the white led array to reflect the CPU load 
    backlight.set_graph(cpu_avg)
print "ssh to ip: " + ip

lcd.set_cursor_position(0, 0)
lcd.write("IP:" + ip)

lcd.set_cursor_position(0, 1)
lcd.write("CPU: ")

lcd.set_cursor_position(13, 1)
lcd.write("IMG")

cpu_sample_count = 200
cpu_samples = [0] * cpu_sample_count
hue = 0.0

lcd.set_contrast(52)

backlight.rgb(200, 200, 200)

camera = picamera.PiCamera()

while True:
    cpu_samples.append(psutil.cpu_percent() / 100.0)
    cpu_samples.pop(0)

    cpu_avg = sum(cpu_samples) / cpu_sample_count

    #turns the white led array to reflect the CPU load
    backlight.set_graph(cpu_avg)

    lcd.set_cursor_position(0, 0)