Esempio n. 1
0
# reset_pin = DigitalInOut(board.G0)
# reset_pin.direction = Direction.OUTPUT
# reset_pin.value = False

# arial12 = bitmap_font.load_font("/fonts/Arial-12.bdf")
arial16 = bitmap_font.load_font("/fonts/Arial-16.bdf")
# arial24 = bitmap_font.load_font("/fonts/Arial-Bold-24.bdf")

display = board.DISPLAY

group = displayio.Group(max_size=25)
outer_circle = Circle(120, 120, 119, outline=0xFFFFFF, stroke=30)
group.append(outer_circle)

inner_circle = Circle(120, 120, 60, fill=0xFFFFFF, outline=0xFFFFFF)
group.append(inner_circle)

display.show(group)
time.sleep(0.01)

while True:
    time.sleep(1)

    for colorcode in my_aqi.all_color_codes():
        for colorcode2 in my_aqi.all_color_codes():
            outer_circle.outline = colorcode
            inner_circle.outline = colorcode2
            inner_circle.fill = colorcode2
            time.sleep(5)
        time.sleep(5)
Esempio n. 2
0
btn3_status = "waiting"
btn4_status = "waiting"
knob_r_prior_disp_saved_mode = 0
knob_g_prior_disp_saved_mode = 0
knob_b_prior_disp_saved_mode = 0

while True:
    # check_button()
    debounced_button1.update()
    debounced_button2.update()
    debounced_button3.update()
    debounced_button4.update()

    if debounced_button1.fell:
        btn1_start_time = time.monotonic()
        circle_mem_1.outline = D_YELLOW
        btn1_status = "pressed"
    if debounced_button2.fell:
        btn2_start_time = time.monotonic()
        circle_mem_2.outline = D_YELLOW
        btn2_status = "pressed"
    if debounced_button3.fell:
        btn3_start_time = time.monotonic()
        circle_mem_3.outline = D_YELLOW
        btn3_status = "pressed"
    if debounced_button4.fell:
        btn4_start_time = time.monotonic()
        circle_mem_4.outline = D_YELLOW
        btn4_status = "pressed"

    downtime = time.monotonic() - btn1_start_time
Esempio n. 3
0
    try:
        aqdata = pm25.read()
        # print(aqdata)
    except RuntimeError:
        print("Unable to read from sensor, retrying...")
        continue

    raw_25 = aqdata["pm25 env"]
    raw_10 = aqdata["pm100 env"]
    aqi_25 = my_aqi.sensor_to_aqi(raw_25, "None", "2.5")
    category_25 = my_aqi.category
    colorname_25 = my_aqi.colorname
    colorcode_25 = my_aqi.colorcode
    aqi_10 = my_aqi.sensor_to_aqi(raw_10, "None", "10.0")
    category_10 = my_aqi.category
    colorname_10 = my_aqi.colorname
    colorcode_10 = my_aqi.colorcode
    outer_circle.outline = colorcode_10
    inner_circle.outline = colorcode_25
    inner_circle.fill = colorcode_25
    #    level1.text = "PM 2.5 AQI:   " + str(aqi_25)
    #    level2.text = category_25
    #    level3.text = colorname_25
    level4.text = str(aqi_25)
    #    level5.text = "PM 10.0 AQI:  " + str(aqi_10)
    #    level6.text = category_10
    #    level7.text = colorname_10
    level7.text = str(aqi_10)
    print("10.0: %X   2.5: %X" % (colorcode_10, colorcode_25))