aalec
¶
AALeC library implementation.
This class tries to implement the same API as the arduino version of this library. The original implementation can be found here: AALeC-V3.
Attention
Some changes:
- This library works only for the BMP280 environment sensor.
- The Wii-Nunchuck controller is not implemented.
Modules:
| Name | Description |
|---|---|
beeper |
Beeper utilities. |
button |
Button Utilities. |
constants |
All the constants of this library. |
display |
Display utilities. |
encoder |
Encoder utility. |
environment |
Environment utilities. |
rgb_strip |
RGB Strip utilities. |
third_party |
External libraries that are shipt here directly for convenance sake. |
Classes:
| Name | Description |
|---|---|
AALeC |
Proxy class to implement the AALeC API. |
AALeC
¶
AALeC()
Proxy class to implement the AALeC API.
Methods:
| Name | Description |
|---|---|
button_changed |
Proxy for |
clear_display |
Proxy for |
draw_progressbar |
Proxy for |
filled_rect |
Proxy for |
get_analog |
Get value from analog pin. |
get_button |
Proxy for |
get_environment_sensor |
Proxy for |
get_gas_resistance |
Proxy for |
get_humidity |
Proxy for |
get_pressure |
Proxy for |
get_rotate |
Proxy for |
get_temp |
Proxy for |
id |
A unique ID for this board. |
play |
Proxy for |
print_line |
Proxy for |
rect |
Proxy for |
reset_rgb_strip |
Proxy for |
reset_rotate |
Proxy for |
rotate_changed |
Proxy for |
set_rgb_led |
Proxy for |
set_rgb_strip |
Proxy for |
Source code in src/aalec/__init__.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
button_changed
¶
button_changed() -> bool
Proxy for Button.button_change.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Source code in src/aalec/__init__.py
78 79 80 81 82 83 84 | |
clear_display
¶
clear_display() -> None
Proxy for Display.clear_display.
Source code in src/aalec/__init__.py
97 98 99 | |
draw_progressbar
¶
Proxy for Display.draw_progressbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
X coordinate of the upper left corner of the progressbar |
required |
y
|
int
|
Y coordinate of the upper left corner of the progressbar |
required |
width
|
int
|
Width of the progressbar in pixel. (x delta to the lower right corner.) |
required |
height
|
int
|
Height of the progressbar in pixel. (y delta to the lower right corner.) |
required |
percent
|
int
|
How many percent the bar is filled (grows to the right). |
required |
Source code in src/aalec/__init__.py
125 126 127 128 129 130 131 132 133 134 135 136 137 | |
filled_rect
¶
Proxy for Display.filled_rect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
X coordinate of the upper left corner of the progressbar |
required |
y
|
int
|
Y coordinate of the upper left corner of the progressbar |
required |
width
|
int
|
Width of the progressbar in pixel. (x delta to the lower right corner.) |
required |
height
|
int
|
Height of the progressbar in pixel. (y delta to the lower right corner.) |
required |
color
|
int
|
Fill color ( |
required |
Source code in src/aalec/__init__.py
113 114 115 116 117 118 119 120 121 122 123 | |
get_analog
¶
get_analog() -> int
Get value from analog pin.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Value of the 10 bit ADC (0-1024) |
Source code in src/aalec/__init__.py
52 53 54 55 56 57 58 | |
get_button
¶
get_button() -> int
Proxy for Button.get_button.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Value of the button. Button pressed: |
Source code in src/aalec/__init__.py
70 71 72 73 74 75 76 | |
get_environment_sensor
¶
get_environment_sensor() -> str
Proxy for Environment.get_environment_sensor.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
"BMP280" |
Source code in src/aalec/__init__.py
163 164 165 166 167 168 169 | |
get_gas_resistance
¶
get_gas_resistance() -> float
Proxy for Environment.get_gas_resistance.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
0.0 (BMP280 doesn't have a gas resistance sensor). |
Source code in src/aalec/__init__.py
195 196 197 198 199 200 201 | |
get_humidity
¶
get_humidity() -> float
Proxy for Environment.get_humidity.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
0.0 (BMP280 doesn't have a humidity sensor). |
Source code in src/aalec/__init__.py
179 180 181 182 183 184 185 | |
get_pressure
¶
get_pressure() -> float
Proxy for Environment.get_pressure.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
current pressure in hPa. |
Source code in src/aalec/__init__.py
187 188 189 190 191 192 193 | |
get_rotate
¶
get_rotate() -> int
Proxy for Encoder.get_rotate.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Value of the rotary encoder. |
Source code in src/aalec/__init__.py
139 140 141 142 143 144 145 | |
get_temp
¶
get_temp() -> float
Proxy for Environment.get_temp.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Current temperature in °C. |
Source code in src/aalec/__init__.py
171 172 173 174 175 176 177 | |
id
¶
id() -> str
A unique ID for this board.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The unique ID for this board. |
Source code in src/aalec/__init__.py
40 41 42 43 44 45 46 47 48 49 50 | |
play
¶
Proxy for Beeper.play.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freq
|
int
|
The frequency of the tone. If the frequency is <=0, no tone will be played. |
required |
dur
|
int | None
|
Duration of the tone in ms.
If set to |
None
|
Source code in src/aalec/__init__.py
60 61 62 63 64 65 66 67 68 | |
print_line
¶
Proxy for Display.print_line.
A line can be at most 16 characters long. (A character has a size of 8x8 pixels.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
int
|
Line number. Valid values are from 1 to 5. |
required |
text
|
str
|
The content to display. |
required |
Source code in src/aalec/__init__.py
86 87 88 89 90 91 92 93 94 95 | |
rect
¶
Proxy for Display.rect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
X coordinate of the upper left corner of the progressbar |
required |
y
|
int
|
Y coordinate of the upper left corner of the progressbar |
required |
width
|
int
|
Width of the progressbar in pixel. (x delta to the lower right corner.) |
required |
height
|
int
|
Height of the progressbar in pixel. (y delta to the lower right corner.) |
required |
color
|
int
|
Frame color ( |
required |
Source code in src/aalec/__init__.py
101 102 103 104 105 106 107 108 109 110 111 | |
reset_rgb_strip
¶
reset_rgb_strip() -> None
Proxy for RgbStrip.reset.
Source code in src/aalec/__init__.py
227 228 229 | |
reset_rotate
¶
reset_rotate(value: int) -> None
Proxy for Encoder.reset_rotate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
new value for the rotary encoder. |
required |
Source code in src/aalec/__init__.py
155 156 157 158 159 160 161 | |
rotate_changed
¶
rotate_changed() -> bool
Proxy for Encoder.rotate_changed.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the value changed since last call. False otherwise. |
Source code in src/aalec/__init__.py
147 148 149 150 151 152 153 | |
set_rgb_led
¶
Proxy for RgbStrip.set_rgb_led.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
led
|
int
|
Index of the led in the strip (starts with 0). |
required |
color
|
RgbColor
|
The color to set |
required |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the |
Source code in src/aalec/__init__.py
203 204 205 206 207 208 209 210 211 212 213 | |
set_rgb_strip
¶
Proxy for RgbStrip.set_rgb_strip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colors
|
list[RgbColor]
|
A list of colors. |
required |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the length of the list of colors is not exactly the number of leds in the strip. |
Source code in src/aalec/__init__.py
215 216 217 218 219 220 221 222 223 224 225 | |