コード例 #1
0
        message.text = "Bad/missing temp sensor"
    if oven.control != last_control:
        last_control = oven.control
        if oven.control:
            circle.fill = 0xFF0000
        else:
            circle.fill = 0x0
    p = ts.touch_point
    status = ""
    last_status = ""

    if p:
        if p[0] >= 0 and p[0] <= 80 and p[1] >= 200 and p[1] <= 240:
            print("touch!")
            if oven.state == "ready":
                button.label = "Stop"
                oven.set_state("start")
            else:
                # cancel operation
                message.text = "Wait"
                button.label = "Wait"
                oven.set_state("wait")
            time.sleep(1)  # for debounce
    if oven.sensor_status:
        if oven.state == "ready":
            status = "Ready"
            if last_state != "ready":
                oven.beep.refresh()
                draw_profile(sgraph, oven.sprofile)
                timer_data.text = format_time(0)
            if button.label != "Start":
コード例 #2
0
#pylint: enable=global-statement

# Set veriables and startup states
button_view1.selected = False
button_view2.selected = True
button_view3.selected = True
showLayer(view1)
hideLayer(view2)
hideLayer(view3)

view_live = 1
icon = 1
icon_name = "Ruby"
button_mode = 1
switch_state = 0
button_switch.label = "OFF"
button_switch.selected = True

# Update out Labels with display text.
text_box(
    feed1_label, TABS_Y,
    "The text on this screen is wrapped so that all of it fits nicely into a \
text box that is ### x ###.", 30)
text_box(
    feed1_label, TABS_Y,
    'The text on this screen is wrapped so that all of it fits nicely into a \
text box that is {} x {}.'.format(feed1_label.bounding_box[2],
                                  feed1_label.bounding_box[3] * 2), 30)

text_box(feed2_label, TABS_Y, 'Tap on the Icon button to meet a new friend.',
         18)
コード例 #3
0
splash.append(button_group)
#display.show(button_group)

print("creating touch screen object")
screen_width = WIDTH
screen_height = HEIGHT
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XL,
                                      board.TOUCH_XR,
                                      board.TOUCH_YD,
                                      board.TOUCH_YU,
                                      calibration=((5200, 59000), (5800,
                                                                   57000)),
                                      size=(screen_width, screen_height))

print("Drawing splash group to screen")
board.DISPLAY.show(splash)

print("starting forever touch loop")
while True:
    touched = ts.touch_point
    if touched:
        for button in buttons:
            if button.contains(touched):
                print("Touched", button.name)
                print("data", button.name)
                button.label = "PROCESSING"
                #button.fill_color = red
                io.send_data(light_position_feed["key"], 25)
                button.label = default_button_label
                #button.fill_color = green
        time.sleep(0.05)