|
1 | 1 | import time |
2 | | -from inventorhatmini import InventorHATMini, NUM_GPIOS |
| 2 | +from inventorhatmini import InventorHATMini, NUM_GPIOS, LED_GPIO_1 |
3 | 3 | from ioexpander import IN # or IN_PU of a pull-up is wanted |
4 | 4 |
|
5 | 5 | """ |
|
18 | 18 |
|
19 | 19 | # Setup each GPIO as an input |
20 | 20 | for i in range(NUM_GPIOS): |
21 | | - board.gpio_mode(i, IN) # or IN_PU of a pull-up is wanted |
| 21 | + board.gpio_pin_mode(i, IN) # or IN_PU of a pull-up is wanted |
22 | 22 |
|
23 | 23 | # Read the GPIOs until the user button is pressed |
24 | 24 | while not board.switch_pressed(): |
25 | 25 |
|
26 | 26 | # Read each GPIO in turn and print its value |
27 | 27 | for i in range(NUM_GPIOS): |
28 | | - value = board.gpio_value(i) |
| 28 | + value = board.gpio_pin_value(i) |
29 | 29 | print(GPIO_NAMES[i], " = ", value, sep="", end=", ") |
30 | 30 |
|
31 | 31 | # Set the neighbouring LED to a colour based on |
32 | 32 | # the input, with Green for high and Blue for low |
33 | 33 | if value: |
34 | | - board.leds.set_hsv(i, 0.333, 1.0, BRIGHTNESS) |
| 34 | + board.leds.set_hsv(i + LED_GPIO_1, 0.333, 1.0, BRIGHTNESS) |
35 | 35 | else: |
36 | | - board.leds.set_hsv(i, 0.666, 1.0, BRIGHTNESS) |
| 36 | + board.leds.set_hsv(i + LED_GPIO_1, 0.666, 1.0, BRIGHTNESS) |
37 | 37 |
|
38 | 38 | # Print a new line |
39 | 39 | print() |
|
0 commit comments