-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhardware.py
42 lines (30 loc) · 1.04 KB
/
hardware.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from machine import Pin
from neopixel import NeoPixel
from primitives.pushbutton import Pushbutton
"""
Asyncio Reference
https://github.com/peterhinch/micropython-async/blob/master/v3/docs/TUTORIAL.md#01-installing-asyncio-primitives
Pushbutton Event Reference
https://github.com/peterhinch/micropython-async/blob/master/v3/docs/DRIVERS.md#event-interface-1
"""
class Input:
"""
Simple class to manage the various connected input devices.
"""
__BRIGHTNESS_PIN = 2
__CHANGE_PIN = 3
__DELAY_PIN = 1
brightness = Pushbutton(Pin(__BRIGHTNESS_PIN, Pin.OUT, Pin.PULL_DOWN))
change = Pushbutton(Pin(__CHANGE_PIN, Pin.OUT, Pin.PULL_DOWN))
delay = Pushbutton(Pin(__DELAY_PIN, Pin.OUT, Pin.PULL_DOWN))
brightness.press_func(None)
change.press_func(None)
delay.press_func(None)
class Output:
"""
Simple class to manage the various output connected devices.
"""
__PIXELS_COUNT = 8
__PIXELS_PIN = 0
___RGB = True
pixels = NeoPixel(Pin(__PIXELS_PIN), __PIXELS_COUNT, bpp=3 if ___RGB else 4)