def main(): # Disable touch repeat touch.enable_repeat(False) while True: # Run one process loop process.main() # Sleep to avoid 100% CPU usage time.sleep(5)
def goooal(team): global score_yellow global score_black global button_pushed global goals_locked if (goals_locked): return button_pushed = False goals_locked = True # GOAL printed huge in block chars lcd.set_cursor_position(0, 0) lcd.write( chr(2) + chr(0) + chr(0) + ' ' + chr(2) + chr(0) + chr(0) + chr(4) + ' ' + chr(6) + ' ' + chr(0) + ' ') lcd.set_cursor_position(0, 1) lcd.write( chr(0) + ' ' + chr(1) + ' ' + chr(0) + ' ' + chr(0) + ' ' + chr(2) + chr(1) + chr(4) + ' ' + chr(0) + ' ') lcd.set_cursor_position(0, 2) lcd.write( chr(3) + chr(0) + chr(0) + ' ' + chr(3) + chr(0) + chr(0) + chr(5) + chr(2) + chr(5) + ' ' + chr(3) + chr(4) + chr(0) + chr(0) + chr(0)) touch.high_sensitivity() touch.enable_repeat(False) lights = 1.0 notify_replay_bot('goooooooooal!') while (lights > 0.0): if (button_pushed): display_scoreboard() goals_locked = False return backlight.set_graph(lights) set_backlight_rainbow(lights) lights = lights - 0.01 sleep(0.0025) if (team == 0): score_yellow = score_yellow + 1 else: score_black = score_black + 1 check_if_someone_won()
sys.path.append('../../') from plugins.clock import Clock from plugins.graph import GraphCPU, GraphTemp from plugins.radio import Radio from plugins.volume import Volume from plugins.utils import Backlight, Contrast print(""" This advanced example uses the menu framework. Providing you have VLC and extra dependencies installed, it should function as an internet radio! Press CTRL+C to exit. """) nav.enable_repeat(True) # We want to use clock both as an option # and as the idle plugin clock = Clock(backlight) """ Using a set of nested dictionaries you can describe the menu you want to display on dot3k. A nested dictionary describes a submenu. An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc A function name will call that function. """ menu = Menu( { 'Clock': clock,
import sys sys.path.append("../../") import dothat.touch as touch import dothat.lcd as lcd import dothat.backlight as backlight from dot3k.menu import Menu from plugins.utils import Backlight, Contrast from plugins.volume import Volume from plugins.clock import Clock from plugins.radio import Radio from plugins.graph import GraphCPU, GraphTemp import time touch.enable_repeat(True) # We want to use clock both as an option # and as the idle plugin clock = Clock(backlight) """ Using a set of nested dictionaries you can describe the menu you want to display on dot3k. A nested dictionary describes a submenu. An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc A function name will call that function. """ menu = Menu({ 'Clock': clock,
import sys sys.path.append("../../") import dothat.touch as touch import dothat.lcd as lcd import dothat.backlight as backlight from dot3k.menu import Menu from plugins.utils import Backlight, Contrast from plugins.volume import Volume from plugins.clock import Clock from plugins.radio import Radio from plugins.graph import GraphCPU, GraphTemp import time touch.enable_repeat(True) # We want to use clock both as an option # and as the idle plugin clock = Clock(backlight) """ Using a set of nested dictionaries you can describe the menu you want to display on dot3k. A nested dictionary describes a submenu. An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc A function name will call that function. """ menu = Menu( { 'Clock': clock,
# from other rooms. Depending on free time, I might maintain this file or not. # print(""" Press CTRL+C to exit. """) import Adafruit_DHT import dothat.touch as j import dothat.lcd as l import dothat.backlight as b import signal import socket import time j.enable_repeat(True) dtemp=float(21.00) # temperature that i want to be in the room rtemp=float(20.00) # read temperature from sensor heatc=0.0 # count to light or dim the vertical leds heat="OFF" # default heating display_status="ON" room="Bedroom: " def status_heating(): s = socket.socket() s.connect(("192.168.1.2",8001)) s.send('status') msg=s.recv(1024) return str(msg)