コード例 #1
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
def viewmsg():
	msgid = db.get('msgseq')
	msg = inbox.get(msgid)
	if msg == None:
		ugfx.set_default_font(ugfx.FONT_SMALL)	
		ugfx.area(0,0,ugfx.width(),ugfx.height(),0x0000)
		ugfx.text(40,100,"NO MESSAGES",ugfx.BLUE)
		pyb.delay(1000)
		return
	else:
		data = json.loads(msg)
		printmsg(data['sender'], data['payload'], data['ts'])
	while True:
		if buttons.is_triggered("JOY_UP"):
			print(msgid)
			msgid -= 1
			msg = inbox.get(msgid)
			if msg != None:
				data = json.loads(msg)
				printmsg(data['sender'], data['payload'], data['ts'])
			else:
				msgid += 1
		if buttons.is_triggered("JOY_DOWN"):
			print(msgid)
			msgid += 1
			msg = inbox.get(msgid)
			if msg != None:
				data = json.loads(msg)
				printmsg(data['sender'], data['payload'], data['ts'])
			else:
				msgid -= 1
		if buttons.is_triggered("BTN_B"):
			display()
			return
コード例 #2
0
ファイル: main.py プロジェクト: liedra/adventure-emf
def game_over(reason):
	ugfx.clear(ugfx.BLACK)
	ugfx.set_default_font(ugfx.FONT_TITLE)
	
	ugfx.text(80,40,"Game Over!",ugfx.WHITE)
	ugfx.text(20,100,reason,ugfx.RED)
	playing=0
コード例 #3
0
ファイル: main.py プロジェクト: bruntonspall/emflap
    def draw_everything():
# We draw the bird at X, and pipes every X*10 locations.
        ugfx.area(0,0,ugfx.width(), ugfx.height(), back_colour)
        draw_bird(10,y)
        for i in range(0,len(pipe_heights)):
            draw_pipe(10+i*10-x,pipe_heights[i])
        #ugfx.text(30,10, "Bird %d,%d Pipe: %d,%d" % (x,y,pipe_heights[x//10],pipe_heights[x//10]+gap), ugfx.WHITE)
        ugfx.text(30,10, "Score %d" % (score), ugfx.WHITE)
コード例 #4
0
def draw_fps():
    ugfx.set_default_font(ugfx.FONT_SMALL)
    #redraw_bg_range(300, 10, 320, 35)
    try:
        fps = int((len(frame_times) / (frame_times[-1] - frame_times[0])) * 1000)
    except ZeroDivisionError:
        fps = 0
    ugfx.text(300, 10, "%d" % fps, ugfx.WHITE)
コード例 #5
0
def getdata():
	server = 'badge.emf.camp'
	#url = 'http://'+server+':9002/schedule'
	#url = 'http://hackspace-leaderboard-scollins.c9users.io/schedule'
	url = 'http://api.ipify.org/'
	resp = get(url).text
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0x0000)
	while True:
		ugfx.text(30,30,resp,ugfx.WHITE)
	return json.loads(resp)
コード例 #6
0
def drawui():
    ugfx.init()
    buttons.init()
    ugfx.clear(ugfx.html_color(0x87F717))

    ugfx.set_default_font(ugfx.FONT_MEDIUM)

    ugfx.fill_circle(50,50, 20, ugfx.WHITE)
    ugfx.fill_circle(50, 100, 20, ugfx.WHITE)

    ugfx.text(45, 45, "A", ugfx.RED)
    ugfx.text(45, 95, "B", ugfx.RED)

    ugfx.text(95, 45, "Flash the lights", ugfx.WHITE)
    ugfx.text(95, 95, "Disco Inferno", ugfx.WHITE)

    ugfx.fill_polygon(270,50, [ [0,0], [40,0], [40, 175], [0, 175] ], ugfx.RED)#  , [230, 100], [230, 60]
    ugfx.fill_polygon(270,50, [ [0,0], [-20,10], [-20, 50], [0, 40] ], ugfx.RED)#  , [230, 100], [230, 60]

    ugfx.area(283, 61, 14, 10, ugfx.WHITE)
    ugfx.area(283, 79, 14, 10, ugfx.WHITE)
    ugfx.area(283, 97, 14, 10, ugfx.WHITE)
    ugfx.area(283, 115, 14, 10, ugfx.WHITE)
    ugfx.area(283, 133, 14, 10, ugfx.WHITE)
    ugfx.area(283, 151, 14, 10, ugfx.WHITE)
    ugfx.area(283, 169, 14, 10, ugfx.WHITE)
    ugfx.area(283, 187, 14, 10, ugfx.WHITE)
コード例 #7
0
ファイル: main.py プロジェクト: sammachin/EMFBadge-NowNext
def nownext():
	ugfx.text(50,120,"Loading... ",ugfx.YELLOW)
	data = getdata()
	venue = list()
	for i in data.keys():
	    venue.append(i)
	venue = sorted(venue)
	print(venue)
	vpos = 0
	hpos = 0
	showevent(venue[vpos], data[venue[vpos]][hpos])
	while True:
		if buttons.is_triggered("JOY_RIGHT"):
			print(vpos)
			vpos += 1
			if vpos > len(venue)-1:
				vpos -= 1
			else:
				pass
			showevent(venue[vpos], data[venue[vpos]][hpos])
		if buttons.is_triggered("JOY_LEFT"):
			print(vpos)
			vpos -= 1
			if vpos < 0:
				vpos = 0
			else:
				pass
			showevent(venue[vpos], data[venue[vpos]][hpos])
		if buttons.is_triggered("JOY_DOWN"):
			print(hpos)
			hpos = 1
			showevent(venue[vpos], data[venue[vpos]][hpos])
		if buttons.is_triggered("JOY_UP"):
			print(hpos)
			hpos = 0
			showevent(venue[vpos], data[venue[vpos]][hpos])
		if buttons.is_triggered("BTN_A"):
			# Need to Implement fetching description by ID here
			pass
		if buttons.is_triggered("BTN_B"):
			mainscreen()
			return
コード例 #8
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
    def print_page(self):
        self.content = ["xxxxxxxxxxxxxxxxxxx             xxxxxxxxx       xxxxxxxxx",
                        "xxxxxxxxxxxx      x               x     x         x     x",
                        "xxxxxxxxxxxx  xxxxx xxxxxxxxxxxxx x  xxxx xxxxxxx x  x  x xxxxxxxxxxxxxxxxxxxxxx",
                        "xxxxxxxxxxxx    xxx x    xxx    x x    xx x     x x     x x  x  xxxxxxxxxxxxxxxx",
                        "xxxxxxxxxxxx  xxxxx x  x  x  x  x x  xxxx x  xxxx x  x  x x  x  xxxxxxxxxxxxxxxx",
                        "xxxxxxxxxxxx      x x  xx   xx  x x  xxxx x    xx x  x  x xx   xxxxxxxxxxxxxxxxx",
                        "xxxxxxxxxxxxxxxxxxx x  xxxxxxx  x xxxxxxx x  xxxx xxxxxxx x  x  xxxxxxxxxxxxxxxx",
                        "                    x  xxxxxxx  x         x  xxxx         x  x  xxxxxxxxxxxxxxxx",
                        "                  xxxxxxxxxxxxxxx       xxxxxxxxx       xxxxxxxxxxxxxxxxxxxxxxxx"]

        ugfx.clear(ugfx.BLACK)
        ugfx.area(0, 5, 320, 45, ugfx.BLUE)
        
        for i,line in enumerate(self.content):
            for j,c in enumerate(line):
                if c=="x":
                    ugfx.area(4*j, 5*i+5, 4, 5, ugfx.YELLOW)
        
        ugfx.area(0, 220, 320, 15, ugfx.YELLOW)
        ugfx.text(35, 221, "EMFFAX: The World at Your Fingertips", ugfx.BLUE)
コード例 #9
0
ファイル: main.py プロジェクト: sammachin/EMFBadge-NowNext
def showevent(stage, event):
	start = event['start_date']
	end = event['end_date']
	speaker = event['speaker']
	text = event['title']
	ugfx.set_default_font(ugfx.FONT_MEDIUM)	
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0x0000)
	ugfx.text(10,10,stage,ugfx.GREY)
	ugfx.text(10,35,"Start: "+start,ugfx.GREEN)
	ugfx.text(10,60,"End: "+end,ugfx.RED)
	ugfx.text(10,85,"Speaker: "+speaker,ugfx.BLUE)
	linelen = 25
	lines = int(math.ceil(len(text)/linelen))
	for l in range(0, lines):
		pixels = l*25+110
		start = l*linelen
		end = l*linelen+linelen
		if end>len(text):
			end = len(text)
		linetext = text[start:end]
		ugfx.text(10,pixels,linetext,0xFFFF)
	return
コード例 #10
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
def display():
	logo = 'apps/nexmo~messages/nexmo_logo.gif'
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0xFFFF)
	ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)	
	ugfx.text(20,20,"My Number is...",ugfx.BLACK)
	ugfx.text(20,130,"Powered By, ",ugfx.GREY)
	ugfx.display_image(15,150,logo)
	ugfx.set_default_font(ugfx.FONT_TITLE)
	ugfx.text(40,75,mynumber+" ",ugfx.BLUE)
コード例 #11
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
def printmsg(sender, text, ts):
	ugfx.set_default_font(ugfx.FONT_SMALL)	
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0x0000)
	ugfx.text(10,10,"From: "+sender,ugfx.BLUE)
	timestamp = timestring(ts)
	linelen = 40
	lines = int(math.ceil(len(text)/linelen))
	for l in range(0, lines):
		pixels = l*25+35
		start = l*linelen
		end = l*linelen+linelen
		if end>len(text):
			end = len(text)
		linetext = text[start:end]
		ugfx.text(10,pixels,linetext,0xFFFF)
	ugfx.text(10,200,timestamp,ugfx.GREEN)
	return
コード例 #12
0
ファイル: main.py プロジェクト: renzenicolai/Mk4-Apps
"""This app goes with the Torch Tutorial"""

___name___ = "Tilda Torch"
___license___ = "MIT"
___dependencies___ = ["sleep"]
___categories___ = ["EMF"]

import ugfx, os, time, sleep
from tilda import Buttons
from machine import Pin

torch = Pin(Pin.GPIO_FET)

ugfx.init()
Pin(Pin.PWM_LCD_BLIGHT).on()
ugfx.clear()

ugfx.text(5, 5, "TORRRRRRCH!!!!!", ugfx.BLACK)
torch.on()

while (not Buttons.is_pressed(Buttons.BTN_A)) and (not Buttons.is_pressed(
        Buttons.BTN_B)) and (not Buttons.is_pressed(Buttons.BTN_Menu)):
    sleep.wfi()

torch.off()

ugfx.clear()
コード例 #13
0
ファイル: main.py プロジェクト: andreacampanella/NeoPixTest
    if buttons.is_triggered("BTN_MENU"):
        break;  

    #we put all the colors in one value for the NeoPixel

    color = (R_value << 16) | (G_value << 8) | B_value 

    #We tell to the NeoPixel to show the color
    neo.display(color)

    #we update the display only where is a change to avoid flickering 

    if(old_color != color):
        old_color = color    
        ugfx.clear(ugfx.html_color(0x7c1143))
        ugfx.text(1, 10, "NeoPixel LED Test ", ugfx.WHITE)
        ugfx.text(1, 30, "Press Menu to exit ", ugfx.WHITE)
        ugfx.text(1, 50, "Left/Right\tto change Red ", ugfx.WHITE)
        ugfx.text(1, 70, "A/B\tto change Green ", ugfx.WHITE)
        ugfx.text(1, 90, "Up/down\tto change Blue ", ugfx.WHITE)    
        ugfx.text(1, 110, "Red\tis: "+str(R_value)+" ", ugfx.WHITE)
        ugfx.text(1, 130, "Green\tis: "+str(G_value)+" ", ugfx.WHITE)
        ugfx.text(1, 150, "Blue\tis: "+str(B_value)+" ", ugfx.WHITE)


ugfx.clear()



コード例 #14
0
ugfx.clear(ugfx.html_color(0xff8800))

def tick():
	ugfx.clear(ugfx.html_color(0x00ff00))
#	for btn in NUM_BTNS:
#		if Buttons.is_pressed(btn):
#			sendReq(str(btn))
	ugfx.clear(ugfx.html_color(0x00ffff))

def sendReq(btnNum):
	ugfx.clear(ugfx.html_color(0x002e5c))
	ugfx.text(1, 10, "You pressed " + str(btnNum), ugfx.WHITE)
	#neo.display(0x888888)
	time.sleep(0.2)
	with http.get('http://'+URL, urlencoded=params+str(btnNum)) as resp:
		if resp.text == "OK": 
			#neo.display(0x008800)
			ugfx.text(1, 30, "Sent OK", ugfx.WHITE)
		else: 
			#neo.display(0x880000)
			ugfx.text(1, 30, "Bad Response:" + resp.text, ugfx.WHITE)

ugfx.clear(ugfx.html_color(0xffff00))

try:
	while 1:
		tick()
except e:
	ugfx.clear(ugfx.html_color(0x002e5c))
	ugfx.text(1, 10, str(e), ugfx.WHITE)
コード例 #15
0
ファイル: accelbar.py プロジェクト: larsweiler/TiLDA
bgcolor = ugfx.BLACK    # foreground colour
fgcolor = ugfx.WHITE    # background colour

ugfx.clear(bgcolor)

pw = 40     # progress bar width
ph = h - 20 # progress bar height
pm = 5      # progress bar margin

# draw the boxes for the progress bars
ugfx.box((w//2)-(w//4)-(pw//2), (h//2)-(ph//2), pw, ph, fgcolor)
ugfx.box((w//2)-(pw//2), (h//2)-(ph//2), pw, ph, fgcolor)
ugfx.box((w//2)+(w//4)-(pw//2), (h//2)-(ph//2), pw, ph, fgcolor)

# label the progress bars
ugfx.text((w//2)-(w//4)-(pw//2)-15, (h//2), 'x', fgcolor)
ugfx.text((w//2)-(pw//2)-15,        (h//2), 'y', fgcolor)
ugfx.text((w//2)+(w//4)-(pw//2)-15, (h//2), 'z', fgcolor)

while not buttons.is_pressed("BTN_MENU"):
    accel = imu.get_acceleration()
    accel_x = accel.get('x')
    accel_y = accel.get('y')
    accel_z = accel.get('z')

    # if acceleration exceeds abs(1), paint the progress bar red
    if accel_x > 1:
        accel_x = 1
        fgcolor_x = ugfx.RED
    elif accel_x < -1:
        accel_x = -1
コード例 #16
0
ファイル: main.py プロジェクト: tswsl1989/Mk4-Apps
           given_name,
           justification=ugfx.Label.CENTER)

# Draw for the user to see
ugfx.orientation(270)
ugfx.set_default_font(ugfx.FONT_SMALL)

# WiFi/Battery update loop
while True:
    ugfx.area(0,
              ugfx.height() - info_height, ugfx.width(), info_height,
              ugfx.WHITE)

    wifi_strength_value = homescreen.wifi_strength()
    if wifi_strength_value:
        wifi_message = 'WiFi: %s%%' % int(wifi_strength_value)
        wifi_text = ugfx.text(center[0],
                              ugfx.height() - info_height, wifi_message,
                              ugfx.BLACK)

    battery_value = homescreen.battery()
    if battery_value:
        battery_message = 'Battery: %s%%' % int(battery_value)
        battery_text = ugfx.text(0,
                                 ugfx.height() - info_height, battery_message,
                                 ugfx.BLACK)

    homescreen.sleep_or_exit(1.5)

restart_to_default()
コード例 #17
0
            disp_square(food[0], food[1], food_colour)
            score = score + 1

        disp_body_straight(body_x[-1], body_y[-1], orient, body_colour)

        if ((body_x[-1] >= edge_x) or (body_x[-1] < 0)
                or (body_y[-1] >= edge_y) or (body_y[-1] < 0)):
            break

        sleep.sleep(0.1)
    return score


playing = 1
while playing:
    score = one_round()
    ugfx.area(0, 0, ugfx.width(), ugfx.height(), 0)
    ugfx.text(30, 30, "GAME OVER Score: %d" % (score), 0xFFFF)
    ugfx.text(30, 60, "Press A to play again", 0xFFFF)
    ugfx.text(30, 90, "Press MENU to quit", 0xFFFF)
    while True:
        sleep.wfi()
        if buttons.is_triggered(Buttons.BTN_A):
            break

        if buttons.is_triggered(Buttons.BTN_Menu):
            playing = 0
            break

app.restart_to_default()
コード例 #18
0
 def show_error(self):
     ugfx.clear()
     ugfx.text(5, 5, 'Error :(', ugfx.RED)
     self.should_redraw = False
コード例 #19
0
___categories___ = ["Games"]
___dependencies___ = [
    "dialogs", "app", "ugfx_helper", "random", "sleep", "buttons"
]

import math, ugfx, ugfx_helper, time, random, sleep, buttons
from tilda import Buttons

ugfx_helper.init()
ugfx.clear()

########################################

while True:
    ugfx.clear()
    if Buttons.is_pressed(Buttons.JOY_Left): ugfx.text(5, 5, "Left", ugfx.RED)
    elif Buttons.is_pressed(Buttons.JOY_Right):
        ugfx.text(5, 5, "Right", ugfx.RED)
    elif Buttons.is_pressed(Buttons.JOY_Down):
        ugfx.text(5, 5, "Down", ugfx.RED)
    elif Buttons.is_pressed(Buttons.JOY_Up):
        ugfx.text(5, 5, "Up", ugfx.RED)
    elif Buttons.is_pressed(Buttons.JOY_Center):
        ugfx.text(5, 5, "Center", ugfx.RED)
    elif Buttons.is_pressed(Buttons.BTN_Menu):
        ugfx.text(5, 5, "Menu", ugfx.RED)
    elif Buttons.is_pressed(Buttons.BTN_A):
        ugfx.text(5, 5, "A", ugfx.RED)
    elif Buttons.is_pressed(Buttons.BTN_B):
        ugfx.text(5, 5, "B", ugfx.RED)
    sleep.wfi()
コード例 #20
0
ファイル: bootstrap.py プロジェクト: prehensile/Mk3-Firmware
			while len(buf) > 0:
				sha256.update(buf)
				buf = file.read(128)
			return str(binascii.hexlify(sha256.digest()), "utf8")
	except:
		return "ERR"

def download(url, target, expected_hash):
	while True:
		get(url).raise_for_status().download_to(target)
		if calculate_hash(target) == expected_hash:
			break

ugfx.init()
ugfx.clear(ugfx.WHITE)
ugfx.text(5, 5, "Downloading TiLDA software", ugfx.BLACK)
label = ugfx.Label(5, 30, ugfx.width() - 10, ugfx.height() - 60, "Please wait")
ugfx.Label(5, ugfx.height() - 30, ugfx.width() - 10, 30, "If nothing happens for 2 minutes please press the reset button on the back")

w = {}
try:
	if "wifi.json" in os.listdir():
		with open("wifi.json") as f:
			w = json.loads(f.read())
except ValueError as e:
	print(e)

if type(w) is dict:
	# convert original format json (dict, one network) to new (list, many networks)
	w = [w]
コード例 #21
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
def screen_3():
    ugfx.clear(ugfx.html_color(0x7c1143))
    ugfx.text(27, 90, "Thank you!", ugfx.WHITE)
コード例 #22
0
ファイル: main.py プロジェクト: sammachin/EMFBadge-NowNext
def mainscreen():
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0x0000)
	ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)	
	ugfx.text(30,30,"EMF Schedule Now & Next ",ugfx.GREY)
	ugfx.text(40,75,"Press [A] to get events ",ugfx.BLUE)
	return
コード例 #23
0
ファイル: name.py プロジェクト: Jonty/Mk3-Firmware
def display_name():
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0xFFFF)
	ugfx.set_default_font("D*")
	ugfx.text(40,120,"MATT",ugfx.YELLOW)
	ugfx.circle(160,200,40,ugfx.GREEN)
コード例 #24
0
ファイル: main.py プロジェクト: Giannie/Mk3-Firmware
ugfx.set_default_font(ugfx.FONT_SMALL)
win_zoom = ugfx.Container(1,33,92,25)
btnl = ugfx.Button(3,3,20,20,"<",parent=win_zoom)
btnr = ugfx.Button(68,3,20,20,">",parent=win_zoom)
l_cat = ugfx.Label(28,3,35,20,"1x",parent=win_zoom)
btnr.attach_input(ugfx.JOY_RIGHT,0)
btnl.attach_input(ugfx.JOY_LEFT,0)
win_zoom.show()

scaling = int((hi-33-33-30)/2)

lines = 0
names = []
seek = -1
if not is_file("log.txt"):
	ugfx.text(20,100,"Log file not found",0)
	wait_for_exit()
	pyb.hard_reset()


#open the file and see how long it is
with open("log.txt","r") as f:
	l = f.readline()
	lines += 1;
	names = l.split(",")
	while len(f.readline()):
		lines += 1;


cl = 0
x_index = 0
コード例 #25
0
ファイル: main.py プロジェクト: Muxelmann/emfbadge-mandelbrot
	return ((val & 0x1f) << 11) | ((val & 0x1f) << 6) | (val & 0x1f)

def m(x, y):
	# Normalised coordinates
	a = 4.0 * (x/size[0] - 0.66)
	b = 3.0 * (y/size[1] - 0.50)

	z = 0
	for n in range(32):
		z = z**2 + a + b*1j
		if abs(z) > 4:
			break
	return 31-n

ugfx.clear(ugfx.GREY)
ugfx.text(30, int(size[1])-30, 'Computing...', ugfx.BLACK)

for y in range(size[1]):
	for x in range(size[0]):
		c = m(x, y)
		ugfx.area(x, y, 1, 1, get_color(c))

	if buttons.is_triggered("BTN_B"):
		break

while playing:
	ugfx.text(30, int(size[1])-30, 'Mandelbrot done :)', ugfx.WHITE)

	while True:
		# pyb.wfi() # Some low power stuff
		if buttons.is_triggered("BTN_A"):
コード例 #26
0
styLbl = ugfx.Style()
styLbl.set_enabled([0xdddddd, ugfx.BLACK, ugfx.GREEN, ugfx.GREY])
styLbl.background(ugfx.BLACK)

styVal = ugfx.Style()
styVal.set_enabled([ugfx.WHITE, ugfx.BLACK, ugfx.GREEN, ugfx.GREY])
styVal.background(ugfx.BLACK)

# Root container
c = ugfx.Container(0, 0, ugfx.width(), ugfx.height(), style=sty)

# Connect to Wifi

print("Init Wifi")
cls()
ugfx.text(0, 0, "WIFI-CONNECT", ugfx.WHITE)

while True:
    try:
        wifi.connect()
    except Exception as e:
        sys.print_exception(e)
        cls()
        ugfx.text(0, 0, "WIFI-TRYAGAIN", ugfx.WHITE)
        continue
    break

# Set up display
# NB: RIGHTTOP and CENTERTOP are reversed

ugfx.set_default_font(ugfx.FONT_NAME)
コード例 #27
0
ファイル: main.py プロジェクト: liedra/adventure-emf
def setup_right_menu():
	ugfx.set_default_font(ugfx.FONT_SMALL)

	if room==1:
		if (haskey1==0):
			ugfx.text(190, 30, "The gate is locked.", ugfx.RED)
			ugfx.text(190, 50, "Maybe you should ", ugfx.RED)
			ugfx.text(190, 70, "find a key.", ugfx.RED)
		elif (haskey1==1):
			ugfx.text(190, 30, "The key fits the lock!", ugfx.RED)
			ugfx.text(190, 50, "A: Escape the Castle", ugfx.RED)
			
	if room==2:
		if orc1:
			ugfx.text(190, 30, "An orc is here.", ugfx.RED)
			ugfx.text(190, 50, "A: Kick", ugfx.RED)
			ugfx.text(190, 70, "B: Punch", ugfx.RED)
			
	if room==5:
		if orc2:
			ugfx.text(190, 30, "A slightly bigger", ugfx.RED) 
			ugfx.text(190, 50, "orc is here.", ugfx.RED)
			ugfx.text(190, 70, "A: Kick", ugfx.RED)
			ugfx.text(190, 90, "B: Tell it a joke", ugfx.RED)
	if room==6:
		ugfx.text(190, 30, "A fountain", ugfx.RED) 
		ugfx.text(190, 50, "is here.", ugfx.RED)
		ugfx.text(190, 70, "A: Drink", ugfx.RED)
		ugfx.text(190, 90, "B: Look in", ugfx.RED)
		
	if room==8:
		if orc3:
			ugfx.text(190, 30, "A humongous", ugfx.RED) 
			ugfx.text(190, 50, "orc is here.", ugfx.RED)
			ugfx.text(190, 70, "A: Kick", ugfx.RED)
			ugfx.text(190, 90, "B: Sneak past", ugfx.RED)
			
			
	if room==9:
		ugfx.text(190, 30, "A key is here.", ugfx.RED)
		ugfx.text(190, 50, "A: Take", ugfx.RED)
		ugfx.text(190, 70, "B: Eat", ugfx.RED)
		
	ugfx.text(30, 200, "HP: "+str(hp), ugfx.BLUE)
コード例 #28
0
ファイル: main.py プロジェクト: trandi/Mk4-Apps
        if (newHookStatus != hookStatus):
            hookStatus = newHookStatus

            currentNumber = ""  #reset number dialed
            ugfx.area(5, 90, 235, 20, ugfx.WHITE)

            hookTimeLastToggle = currentTimeMs
            print("Hook: " + str(hookStatus))


##### MAIN #####
# initialize screen
ugfx.init()
ugfx.clear()
ugfx.backlight(0)
ugfx.text(5, 60, "NUMBER", ugfx.BLACK)

# MAIN loop
while True:
    currentTimeMs = utime.ticks_ms()

    updateDial(currentTimeMs)

    updateBell(currentTimeMs)

    updatePhone()

    updateHook(currentTimeMs)

    updateGeneralInfo(currentTimeMs)
コード例 #29
0
ファイル: main.py プロジェクト: SimonWoolf/Mk3-Firmware
ugfx.set_default_font(ugfx.FONT_SMALL)
win_zoom = ugfx.Container(1, 33, 92, 25)
btnl = ugfx.Button(3, 3, 20, 20, "<", parent=win_zoom)
btnr = ugfx.Button(68, 3, 20, 20, ">", parent=win_zoom)
l_cat = ugfx.Label(28, 3, 35, 20, "1x", parent=win_zoom)
btnr.attach_input(ugfx.JOY_RIGHT, 0)
btnl.attach_input(ugfx.JOY_LEFT, 0)
win_zoom.show()

scaling = int((hi - 33 - 33 - 30) / 2)

lines = 0
names = []
seek = -1
if not is_file("log.txt"):
    ugfx.text(20, 100, "Log file not found", 0)
    wait_for_exit()
    pyb.hard_reset()

#open the file and see how long it is
with open("log.txt", "r") as f:
    l = f.readline()
    lines += 1
    names = l.split(",")
    while len(f.readline()):
        lines += 1

cl = 0
x_index = 0

names = [n.strip() for n in names]
コード例 #30
0
def mainscreen():
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0x0000)
	ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)	
	ugfx.text(30,30,"Whats My IP",ugfx.YELLOW)
	ugfx.text(40,75,"Press [A] to continue",ugfx.YELLOW)
	return
コード例 #31
0
def write_instructions():
    ugfx.clear(ugfx.html_color(0x000000))
    ugfx.orientation(270)
    ugfx.text(5, 5, "Press A to refresh", ugfx.WHITE)
    ugfx.text(5, 25, "Press B to change the url", ugfx.WHITE)
    ugfx.text(5, 45, "Press Menu to exit", ugfx.WHITE)
コード例 #32
0
ファイル: main.py プロジェクト: pixelpusher/algoraveEMF2016
        # set orientation
        flip = 1
        ival = imu.get_acceleration()
        if ival['y'] < 0:
        	ugfx.orientation(0)
        else:
        	ugfx.orientation(180)

        if ival['y'] < 0:
            flip = -1

        # estimate 10 characters per screen...
        ugfx.clear(backgrounds[colorIndex])
        colorIndex += 1
        colorIndex %= len(backgrounds)
        accel = ival['x']*flip # -1 to 1

        # Center middle
        # estimate 32px per character... ugly
        position += int(accel*speed)
        if (position > name_len):
            position = -name_len
        if (position < -name_len):
            position = name_len

        ugfx.text(position-name_len, cy, name, ugfx.BLACK)
        ugfx.text(position, cy, name, ugfx.WHITE)
        ugfx.text(position+name_len, cy, name, ugfx.BLACK)

        pyb.delay(100)
コード例 #33
0
ファイル: main.py プロジェクト: tswsl1989/Mk4-Apps
''' Random card generator, includes Base Set, The First Expansion, The Second Expansion, The Third Expansion, The Fourth Expansion, The Fifth Expansion, The Sixth Expansion, Green Box Expansion, 90s Nostalgia Pack, Box Expansion, Fantasy Pack, Food Pack, Science Pack and World Wide Web Pack '''

___name___ = "Cards Against EMF"
___license___ = ["MIT"]
___dependencies___ = ["ugfx_helper", "sleep"]
___categories___ = ["Games"]
___bootstrapped___ = False  # Whether or not apps get downloaded on first install. Defaults to "False", mostly likely you won't have to use this at all.

import ugfx, json, random

from tilda import Buttons
from app import restart_to_default

ugfx.init()
ugfx.clear()
ugfx.text(10, 10, "CARDS AGAINST EMF", ugfx.BLACK)
ugfx.text(10, 40, "A for a question", ugfx.BLACK)
ugfx.text(10, 60, "B for an answer", ugfx.BLACK)
ugfx.text(10, 80, "MENU to exit", ugfx.BLACK)

b = ugfx.Style()
b.set_background(ugfx.BLACK)
b.set_enabled([ugfx.WHITE, ugfx.BLACK, ugfx.BLACK,
               ugfx.BLACK])  # sets the style for when something is enabled
w = ugfx.Style()
w.set_background(ugfx.WHITE)

with open("cards_against_emf/cards.json") as data:
    d = json.load(data)

コード例 #34
0
ファイル: main.py プロジェクト: jediminer543/Mk4-Apps
    0xB5B5B5, 0xB3B3B3, 0xB0B0B0, 0xADADAD, 0xABABAB, 0xA8A8A8, 0xA6A6A6,
    0xA3A3A3, 0xA1A1A1, 0x9E9E9E, 0x9C9C9C, 0x999999, 0x969696, 0x949494,
    0x919191, 0x8F8F8F, 0x8C8C8C, 0x8A8A8A, 0x878787, 0x858585, 0x828282,
    0x7F7F7F, 0x7D7D7D, 0x7A7A7A, 0x787878, 0x757575, 0x737373, 0x707070,
    0x6E6E6E, 0x6B6B6B, 0x696969, 0x666666, 0x636363, 0x616161, 0x5E5E5E,
    0x5C5C5C, 0x595959, 0x575757, 0x545454, 0x525252, 0x4F4F4F, 0x4D4D4D,
    0x4A4A4A, 0x474747, 0x454545, 0x424242, 0x404040, 0x3D3D3D, 0x3B3B3B,
    0x383838, 0x363636, 0x333333, 0x303030, 0x2E2E2E, 0x2B2B2B, 0x292929,
    0x262626, 0x242424, 0x212121, 0x1F1F1F, 0x1C1C1C, 0x1A1A1A, 0x171717,
    0x141414, 0x121212, 0x0F0F0F, 0x0D0D0D, 0x0A0A0A, 0x080808, 0x050505,
    0x030303
]
n = Neopix()
ugfx.init()
ugfx.clear()
ugfx.text(5, 5, "PRESS B TO PARTY, MENU TO QUIT, A TO LOOP", ugfx.BLACK)


def ledChange():
    print("led change!")
    RedLEDNum = random.randint(0, 1)
    GreenLEDNum = random.randint(0, 1)

    if RedLEDNum == 0:
        LED(LED.RED).on()
    else:
        LED(LED.RED).off()

    if GreenLEDNum == 0:
        LED(LED.GREEN).on()
    else:
コード例 #35
0
ファイル: main.py プロジェクト: jediminer543/Mk4-Backend
"""Description of App1"""
___categories___ = ["CategoryForApp1", "SecondaryCategory"]
___bootstraped___ = True
___dependencies___ = ["lib1", "lib3"]
___license___ = "MIT"

import ugfx, pyb, buttons

ugfx.init()
ugfx.clear()
buttons.init()
ugfx.set_default_font(ugfx.FONT_NAME)
ugfx.text(27, 90, "APP1", ugfx.WHITE)
pyb.wfi()
ugfx.clear()

コード例 #36
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
    pyb.delay(400)

# Output a single letter in Morse code.
def convert_letter(letter):
    # Only convert alphanumeric characters.
    if letter in morse_map:
        morse = morse_map[letter]
        for char in morse:
            if char == ".":
                dot()
            else:
                dash()

# Output a string in Morse code.
def convert_string(string):
    words = string.split()
    for word in words:
        for letter in word:
            convert_letter(letter)
            letter_space()
        word_space()


# Get string input from user.
string = dialogs.prompt_text("Enter string to convert", init_text="", width = 310, height = 220)

if string:
    ugfx.area(0, 0, ugfx.width(), ugfx.height(), 0)
    ugfx.text(30, 60, "Morse Code...", 0xFFFF)
    convert_string(string.upper())
コード例 #37
0
""" Catalin's App
"""
___title___ = "Catalin's App"
___license___ = "MIT"
___dependencies___ = ["ugfx_helper", "sleep", "dialogs", "database"]
___categories___ = ["Other"]
___bootstrapped___ = False

import dialogs, ugfx_helper, ugfx, app, sleep
from tilda import Buttons

# initialize screen
ugfx_helper.init()
ugfx.clear()

# show text
ugfx.text(5, 5, "Hello World :)", ugfx.BLACK)

# waiting until a button has been pressed
while (not Buttons.is_pressed(Buttons.BTN_A)) and (not Buttons.is_pressed(
        Buttons.BTN_B)) and (not Buttons.is_pressed(Buttons.BTN_Menu)):
    sleep.wfi()

# closing
ugfx.clear()

dialogs.prompt_boolean("Is this a great device Y/N? :D")

app.restart_to_default()
コード例 #38
0
ファイル: main.py プロジェクト: tswsl1989/Mk4-Apps
playing = 1
while playing:
    points[0] = 0
    points[1] = 0

    while (points[0] < minScore) and (points[1] < minScore):
        score = one_round()

        points[0] = points[0] + score[0]
        points[1] = points[1] + score[1]

    ugfx.area(0,0,ugfx.width(),ugfx.height(),0)

    ugfx.orientation(90)
    ugfx.set_default_font(ugfx.FONT_TITLE)
    ugfx.text(30, 138, "GAME ",ballColor)
    ugfx.text(30, 158, "OVER ",ballColor)

    ugfx.set_default_font(ugfx.FONT_SMALL)
    ugfx.text(70, 220, "Score: %d - %d " % (points[0], points[1]), ballColor)
    ugfx.text(36, 260, "Press A to play again ", ballColor)
    ugfx.text(40, 280, "Press MENU to quit " , ballColor)

    ugfx.orientation(270)
    ugfx.set_default_font(ugfx.FONT_TITLE)
    ugfx.text(30, 138, "GAME ",ballColor)
    ugfx.text(30, 158, "OVER ",ballColor)

    ugfx.set_default_font(ugfx.FONT_SMALL)
    ugfx.text(70, 220, "Score: %d - %d " % (points[1], points[0]), ballColor)
    ugfx.text(36, 260, "Press A to play again ", ballColor)
コード例 #39
0
ファイル: main.py プロジェクト: catalin-ursachi/Mk4-Apps
def display_text(text):
    ugfx.text(40, 150, text, ugfx.WHITE)
コード例 #40
0
ファイル: main.py プロジェクト: Giannie/Mk3-Firmware
			disp_square(food[0],food[1],food_colour)
			score = score + 1

		disp_body_straight(body_x[-1],body_y[-1],orient,body_colour)


		if ((body_x[-1] >= edge_x) or (body_x[-1] < 0) or (body_y[-1] >= edge_y) or (body_y[-1] < 0)):
			break

		pyb.delay(100)
	return score
	
playing = 1
while playing:
	score = one_round()
	ugfx.area(0,0,ugfx.width(),ugfx.height(),0)
	ugfx.text(30, 30, "GAME OVER Score: %d" % (score), 0xFFFF)
	ugfx.text(30, 60, "Press A to play again", 0xFFFF)
	ugfx.text(30, 90, "Press MENU to quit" , 0xFFFF)
	while True:
		pyb.wfi()
		if buttons.is_triggered("BTN_A"):
			break

		if buttons.is_triggered("BTN_MENU"):
			playing = 0 #pyb.hard_reset()
			break



コード例 #41
0
def write_line(text):
    global current_line
    ugfx.text(5, 5 + (current_line * LINE_HEIGHT), text, ugfx.WHITE)
    print(text)
    current_line += 1
コード例 #42
0
def render_ui(note, delay, octave, rest_delay):
    ugfx.clear()
    ugfx.text(0, 0, "lets make some music! {}".format(note), ugfx.BLACK)
    ugfx.text(0, 100, "Delay: {}ms".format(delay), ugfx.BLACK)
    ugfx.text(0, 200, "Octave: {}".format(octave), ugfx.BLACK)
    ugfx.text(0, 300, "Note Delay: {}".format(rest_delay), ugfx.BLACK)
コード例 #43
0
ファイル: main.py プロジェクト: liedra/adventure-emf
    tone(d,bp,pp)
    tone(d,bp,pp)
    tone(g,bp*4,pp)
    
    tone(d,bp,pp)
    tone(d,bp,pp)
    tone(d,bp,pp)
    tone(g,bp*4,pp)

	
			

ugfx.set_default_font(ugfx.FONT_TITLE)

ugfx.clear(ugfx.BLACK)
ugfx.text(80,40,"Adventure!",ugfx.WHITE)
ugfx.text(20,100,"Escape from the Castle!",ugfx.RED)
play_theme()
pyb.delay(2000)
room_1()
###start at this room


while True:
	playing=1

	while playing:
	
		if buttons.is_triggered("JOY_UP"):
			if room == 1:
				room=2
コード例 #44
0
"""Loads the latest image from E621.net
"""
___name___ = "e621"
___license___ = "MIT"
___dependencies___ = ["app", "wifi", "http", "homescreen"]
___categories___ = ["Other"]
___launchable___ = True

import ugfx, wifi, http, json
from homescreen import sleep_or_exit

ugfx.clear()
ugfx.text(5, 5, "Connecting To WIFI", ugfx.BLACK)
wifi.connect()
ugfx.text(5, 5, "Connecting To WIFI", ugfx.WHITE)
while True:
    try:
        ugfx.text(5, 5, ">", ugfx.BLACK)
        url = json.loads(
            http.get(
                "https://e621.net/post/index.json?limit=1&tags=order:random",
                headers={
                    "User-Agent": "TiLDA MK4 (itlin)"
                }).content)[0]["file_url"]
        ugfx.text(5, 5, ">>", ugfx.BLACK)
        ugfx.text(5, 5, ">>", ugfx.GREEN)
        print(url[-3:])
        if url[-3:] == "png":
            print("png")
            ugfx.display_image(
                0, 0,
コード例 #45
0
ファイル: main.py プロジェクト: liedra/adventure-emf
def orc_kicking(strength, orc, hp):
	ugfx.area(190,30,300,180, ugfx.BLACK)
	damage_orc = (pyb.rng()%6)
	ugfx.text(190, 30, "You kick the orc!", ugfx.WHITE)
	ugfx.text(190, 50, "The orc takes", ugfx.WHITE)
	ugfx.text(190, 70, str(damage_orc)+" damage.", ugfx.WHITE)
	orc = orc-damage_orc
	tone(155.563,250,30)
	pyb.delay(1000)
	damage = (pyb.rng()%strength)
	ugfx.text(190, 100, "The orc kicks you!", ugfx.WHITE)
	ugfx.text(190, 120, "You take "+str(damage)+" damage.", ugfx.WHITE)
	hp = hp-damage
	tone(174.614,250,30)
	
	ugfx.text(190, 150, "A: Kick again", ugfx.RED)
	ugfx.text(190, 170, "B: Run away", ugfx.RED)
	
	ugfx.area(30,200,180,250, ugfx.BLACK)
	ugfx.text(30, 200, "HP: "+str(hp), ugfx.BLUE)
	return orc,hp
コード例 #46
0
s.set_background(ugfx.BLACK)
ugfx.set_default_style(s)

Buttons.enable_interrupt(Buttons.BTN_A,
                         lambda button_id: get_beer(),
                         on_press=True,
                         on_release=False)
Buttons.enable_interrupt(Buttons.BTN_B,
                         lambda button_id: toggle_orientation(),
                         on_press=True,
                         on_release=False)
Buttons.enable_interrupt(Buttons.BTN_Menu,
                         lambda button_id: app.restart_to_default(),
                         on_press=True,
                         on_release=False)

ugfx.text(5, 10, "Instructions:", ugfx.WHITE)
ugfx.text(5, 30, "Press the A button to refresh", ugfx.WHITE)
ugfx.text(5, 45, "Press the B button to rotate", ugfx.WHITE)
ugfx.text(5, 60, "Press the Menu button to exit", ugfx.WHITE)
ugfx.text(5, 90, "!", ugfx.RED)
ugfx.text(15, 90, "means the stock is low", ugfx.WHITE)
ugfx.text(5, 120, "Loading data from the bar...", ugfx.WHITE)

get_beer()

while True:
    sleep.wfi()

ugfx.clear()
app.restart_to_default()
コード例 #47
0
def error_screen(state):
    ugfx.text(5, 100, "Error: try again later :(", ugfx.WHITE)
コード例 #48
0
def write_loading():
    ugfx.clear(ugfx.html_color(0x000000))
    ugfx.orientation(90)
    ugfx.text(5, 5, "Loading...", ugfx.WHITE)
    ugfx.orientation(270)
    ugfx.text(5, 5, "Loading...", ugfx.WHITE)
コード例 #49
0
"""Weather

Displays the weather where you are.
"""

___name___ = "Weather"
___license___ = "MIT"
___dependencies___ = ["ugfx_helper"]
___categories___ = ["Homescreens"]
___bootstrapped___ = True  # Whether or not apps get downloaded on first install. Defaults to "False", mostly likely you won't have to use this at all.

import ugfx_helper, ugfx, app
from tilda import Buttons
# import weather

ugfx_helper.init()
ugfx.clear(ugfx.BLACK)

ugfx.text(5, 5, "Hi Alan!", ugfx.WHITE)

Buttons.enable_interrupt(Buttons.BTN_B,
                         lambda button_id: app.restart_to_default(),
                         on_press=True,
                         on_release=False)

while True:
    sleep.wfi()

ugfx.clear()
app.restart_to_default()
コード例 #50
0
def mainscreen():
    ugfx.area(0, 0, ugfx.width(), ugfx.height(), 0x0000)
    ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)
    ugfx.text(30, 30, "EMF Schedule Now & Next ", ugfx.GREY)
    ugfx.text(40, 75, "Press [A] to get events ", ugfx.BLUE)
    return
コード例 #51
0
"""A big "thank you" to all our Sponsors who made this year's badge possible!"""

___name___ = "Sponsors"
___license___ = "MIT"
___dependencies___ = ["wifi", "http", "ugfx_helper", "sleep"]
___categories___ = ["EMF"]
___bootstrapped___ = True

import ugfx_helper, os, wifi, ugfx, http, time, sleep
from tilda import Buttons

ugfx_helper.init()
ugfx.clear()

ugfx.text(5, 5, "Loading...", ugfx.BLACK)
try:
    image = http.get("http://s3.amazonaws.com/tilda-badge/sponsors/screen.png"
                     ).raise_for_status().content
    ugfx.display_image(0, 0, bytearray(image))
except:
    ugfx.clear()
    ugfx.text(5, 5, "Couldn't download sponsors", ugfx.BLACK)

while (not Buttons.is_pressed(Buttons.BTN_A)) and (not Buttons.is_pressed(
        Buttons.BTN_B)) and (not Buttons.is_pressed(Buttons.BTN_Menu)):
    sleep.wfi()

ugfx.clear()
コード例 #52
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
        pyb.delay(100)
    return score
    
playing = 1
while playing:
    score = one_round()
    new_high_score = False
    with Database() as db:
        high_score = db.get("improved_snake-high-score", 0)
        if score > high_score:
            db.set("improved_snake-high-score", score)
            new_high_score = True

    ugfx.area(0,0,ugfx.width(),ugfx.height(),0)
    ugfx.text(30, 30, "GAME OVER Score: %d" % (score), 0xFFFF)
    if new_high_score:
        ugfx.text(30, 60, "NEW HIGH SCORE!", 0xFFFF)
    else:
        ugfx.text(30, 60, "High score: %d" % (high_score), 0xFFFF)  
    ugfx.text(30, 90, "Press A to play again", 0xFFFF)
    ugfx.text(30, 120, "Press MENU to quit" , 0xFFFF)
    while True:
        pyb.wfi()
        if buttons.is_triggered("BTN_A"):
            break

        if buttons.is_triggered("BTN_MENU"):
            playing = 0 #pyb.hard_reset()
            break
コード例 #53
0
ファイル: uidemo.py プロジェクト: Giannie/Mk3-Firmware
import ugfx
import os

#options.destroy()
#btn_ok.destroy()
#btn_menu.destroy()

ugfx.init()

ugfx.set_default_font("D*")

ugfx.text(40, 0, "EMF BADGE 2016", ugfx.PURPLE)

ugfx.set_default_font("C*")

options = ugfx.List(0,0,160,150)
btn_ok = ugfx.Button(200,50,70,30,"A: Run")
btn_menu = ugfx.Button(200,90,70,30,"M: Menu")

files = os.listdir()

for f in files:
	options.add_item(f)

btn_menu.attach_input(ugfx.BTN_MENU)
btn_ok.attach_input(ugfx.BTN_A)
コード例 #54
0
"""A big "thank you" to all our Sponsors who made this year's badge possible!"""

___name___         = "zdan"
___license___      = "MIT"
___dependencies___ = ["wifi", "http", "ugfx_helper", "sleep", "app"]
___categories___   = ["Other"]
___bootstrapped___ = False

import ugfx_helper, os, wifi, ugfx, http, time, sleep, app
from tilda import Buttons

ugfx_helper.init()
ugfx.clear()

ugfx.text(5, 5, "Loading awesomeness:", ugfx.BLACK)
try:
    image = http.get("http://dodskypict.com/D/Abstract-Rainbow-Wallpaper-On-Wallpaper-Hd-16-240x320.jpg").raise_for_status().content
    ugfx.display_image(0,0,bytearray(image))
except:
    ugfx.clear()
    ugfx.text(5, 5, "Couldn't download zdan", ugfx.BLACK)

while (not Buttons.is_pressed(Buttons.BTN_A)) and (not Buttons.is_pressed(Buttons.BTN_B)) and (not Buttons.is_pressed(Buttons.BTN_Menu)):
    sleep.wfi()

ugfx.clear()
app.restart_to_default()
コード例 #55
0
def write_hot_instructions():
    ugfx.orientation(270)
    ugfx.text(3, 85, "Press A to refresh or press B", ugfx.WHITE)
    ugfx.text(3, 105, "to change the url or check", ugfx.WHITE)
    ugfx.text(3, 125, "your wifi settings...", ugfx.WHITE)
コード例 #56
0
ファイル: main.py プロジェクト: Muxelmann/emfbadge-conway
draw_grid()


running = False

while playing:
	while True:
		# pyb.wfi() # Some low power stuff
		if buttons.is_triggered('BTN_A'):
			update()
			draw_grid()

		if buttons.is_triggered('BTN_B'):
			running = not running

		if buttons.is_triggered('JOY_CENTER'):
			running = False
			random_grid()
			draw_grid()

		if running:
			update()
			draw_grid()
			ugfx.text(15, 15, 'Runnig...', ugfx.YELLOW)
		else:
			ugfx.text(15, 15, 'Paused...', ugfx.YELLOW)

		if buttons.is_triggered('BTN_MENU'):
			playing = False #pyb.hard_reset()
			break
コード例 #57
0
    0xB5B5B5, 0xB3B3B3, 0xB0B0B0, 0xADADAD, 0xABABAB, 0xA8A8A8, 0xA6A6A6,
    0xA3A3A3, 0xA1A1A1, 0x9E9E9E, 0x9C9C9C, 0x999999, 0x969696, 0x949494,
    0x919191, 0x8F8F8F, 0x8C8C8C, 0x8A8A8A, 0x878787, 0x858585, 0x828282,
    0x7F7F7F, 0x7D7D7D, 0x7A7A7A, 0x787878, 0x757575, 0x737373, 0x707070,
    0x6E6E6E, 0x6B6B6B, 0x696969, 0x666666, 0x636363, 0x616161, 0x5E5E5E,
    0x5C5C5C, 0x595959, 0x575757, 0x545454, 0x525252, 0x4F4F4F, 0x4D4D4D,
    0x4A4A4A, 0x474747, 0x454545, 0x424242, 0x404040, 0x3D3D3D, 0x3B3B3B,
    0x383838, 0x363636, 0x333333, 0x303030, 0x2E2E2E, 0x2B2B2B, 0x292929,
    0x262626, 0x242424, 0x212121, 0x1F1F1F, 0x1C1C1C, 0x1A1A1A, 0x171717,
    0x141414, 0x121212, 0x0F0F0F, 0x0D0D0D, 0x0A0A0A, 0x080808, 0x050505,
    0x030303
]
n = Neopix()
ugfx.init()
ugfx.clear()
ugfx.text(5, 5, "PRESS B TO PARTY, A TO QUIT", ugfx.BLACK)


def ledChange():
    print("led change!")
    RedLEDNum = random.randint(0, 1)
    GreenLEDNum = random.randint(0, 1)

    if RedLEDNum == 0:
        LED(LED.RED).on()
    else:
        LED(LED.RED).off()

    if GreenLEDNum == 0:
        LED(LED.GREEN).on()
    else:
コード例 #58
0
ファイル: main.py プロジェクト: Kimbsy/EMF_20016
 def print_page(self):
     ugfx.clear(ugfx.BLACK)
     ugfx.area(0, 5, 320, 45, ugfx.BLUE)
     
     ugfx.area(0, 220, 320, 15, ugfx.YELLOW)
     ugfx.text(35, 221, "EMFFAX: The World at Your Fingertips", ugfx.BLUE)
コード例 #59
0
"""
___name___ = "Screen Party"
___license___ = "MIT"
___dependencies___ = ["ugfx_helper", "sleep", "random"]
___categories___ = ["Homescreens"]
___bootstrapped___ = False

import random, ugfx, buttons, math, time
from app import App, restart_to_default
from homescreen import clean_up
from tilda import LED, Buttons

# Welcome
ugfx.init()
ugfx.clear(ugfx.BLACK)
ugfx.text(5, 5, "Press A to Start and B to stop", ugfx.WHITE)
ugfx.text(5, ugfx.height() - 20, "By Pez (@Pezmc)", ugfx.WHITE)

# Draw colours
grid_size = 20
grid_width = math.ceil(ugfx.width() / grid_size)
grid_height = math.ceil(ugfx.height() / grid_size)
colour_list = [
    0xB0171F, 0xDC143C, 0xFFB6C1, 0xFFAEB9, 0xEEA2AD, 0xCD8C95, 0x8B5F65,
    0xFFC0CB, 0xFFB5C5, 0xEEA9B8, 0xCD919E, 0x8B636C, 0xDB7093, 0xFF82AB,
    0xEE799F, 0xCD6889, 0x8B475D, 0xFFF0F5, 0xEEE0E5, 0xCDC1C5, 0x8B8386,
    0xFF3E96, 0xEE3A8C, 0xCD3278, 0x8B2252, 0xFF69B4, 0xFF6EB4, 0xEE6AA7,
    0xCD6090, 0x8B3A62, 0x872657, 0xFF1493, 0xEE1289, 0xCD1076, 0x8B0A50,
    0xFF34B3, 0xEE30A7, 0xCD2990, 0x8B1C62, 0xC71585, 0xD02090, 0xDA70D6,
    0xFF83FA, 0xEE7AE9, 0xCD69C9, 0x8B4789, 0xD8BFD8, 0xFFE1FF, 0xEED2EE,
    0xCDB5CD, 0x8B7B8B, 0xFFBBFF, 0xEEAEEE, 0xCD96CD, 0x8B668B, 0xDDA0DD,
コード例 #60
0
import ugfx
import os

#options.destroy()
#btn_ok.destroy()
#btn_menu.destroy()

ugfx.init()

ugfx.set_default_font("D*")

ugfx.text(40, 0, "EMF BADGE 2016", ugfx.PURPLE)

ugfx.set_default_font("C*")

options = ugfx.List(0, 0, 160, 150)
btn_ok = ugfx.Button(200, 50, 70, 30, "A: Run")
btn_menu = ugfx.Button(200, 90, 70, 30, "M: Menu")

files = os.listdir()

for f in files:
    options.add_item(f)

btn_menu.attach_input(ugfx.BTN_MENU)
btn_ok.attach_input(ugfx.BTN_A)