diff --git a/micropython/examples/interstate75/75W/buttons.py b/micropython/examples/interstate75/75W/buttons.py new file mode 100644 index 00000000..7916dbc5 --- /dev/null +++ b/micropython/examples/interstate75/75W/buttons.py @@ -0,0 +1,49 @@ +''' +buttons.py +Push either switch A, switch B or the BOOT switch (in the case of the non-w version) to change the display +''' +import interstate75 + +i75 = interstate75.Interstate75(display=interstate75.DISPLAY_INTERSTATE75_32X32, interstate75w=True) +graphics = i75.display + +width = i75.width +height = i75.height + +A_COLOR = graphics.create_pen(0x31, 0x81, 0xCE) +A_TEXT = graphics.create_pen(0xCE, 0x7E, 0x31) + +B_COLOR = graphics.create_pen(0xC3, 0x3C, 0xBD) +B_TEXT = graphics.create_pen(0x3C, 0xC3, 0x42) + +BOOT_COLOR = graphics.create_pen(0xC3, 0x3C, 0xBD) +BOOT_TEXT = graphics.create_pen(0x3C, 0xC3, 0x42) + +BG = graphics.create_pen(0xC1, 0x99, 0x3E) + + +def display_a(): + graphics.set_pen(A_COLOR) + graphics.clear() + graphics.set_pen(A_TEXT) + graphics.text("A", 8, 6, False, 3) + i75.update() + + +def display_b(): + graphics.set_pen(B_COLOR) + graphics.clear() + graphics.set_pen(B_TEXT) + graphics.text("B", 8, 6, False, 3) + i75.update() + + +graphics.set_pen(BG) +graphics.clear() +i75.update() + +while 1: + if i75.switch_pressed(interstate75.SWITCH_A): + display_a() + if i75.switch_pressed(interstate75.SWITCH_B): + display_b() diff --git a/micropython/examples/interstate75/75W/cheerlights.py b/micropython/examples/interstate75/75W/cheerlights.py index 79d41231..14aff563 100644 --- a/micropython/examples/interstate75/75W/cheerlights.py +++ b/micropython/examples/interstate75/75W/cheerlights.py @@ -77,7 +77,7 @@ def update_leds(): print("LEDs updated!") -i75 = interstate75.Interstate75(display=interstate75.DISPLAY_INTERSTATE75_32X32) +i75 = interstate75.Interstate75(display=interstate75.DISPLAY_INTERSTATE75_32X32, interstate75w=True) graphics = i75.display width = i75.width diff --git a/micropython/examples/interstate75/75W/clock.py b/micropython/examples/interstate75/75W/clock.py index c95ca905..7be075c0 100644 --- a/micropython/examples/interstate75/75W/clock.py +++ b/micropython/examples/interstate75/75W/clock.py @@ -14,7 +14,7 @@ import network import ntptime from interstate75 import Interstate75, DISPLAY_INTERSTATE75_32X32 -i75 = Interstate75(display=DISPLAY_INTERSTATE75_32X32) +i75 = Interstate75(display=DISPLAY_INTERSTATE75_32X32, interstate75w=True) graphics = i75.display width = i75.width diff --git a/micropython/examples/interstate75/buttons.py b/micropython/examples/interstate75/buttons.py index 4f2ae996..57212468 100644 --- a/micropython/examples/interstate75/buttons.py +++ b/micropython/examples/interstate75/buttons.py @@ -30,14 +30,6 @@ def display_a(): i75.update() -def display_b(): - graphics.set_pen(B_COLOR) - graphics.clear() - graphics.set_pen(B_TEXT) - graphics.text("B", 8, 6, False, 3) - i75.update() - - def display_boot(): graphics.set_pen(BOOT_COLOR) graphics.clear() @@ -53,7 +45,5 @@ i75.update() while 1: if i75.switch_pressed(interstate75.SWITCH_A): display_a() - if i75.switch_pressed(interstate75.SWITCH_B): - display_b() if i75.switch_pressed(interstate75.SWITCH_BOOT): display_boot()