Skip to content

Commit c798282

Browse files
add docs/api.md
1 parent 52c5e94 commit c798282

File tree

1 file changed

+175
-0
lines changed

1 file changed

+175
-0
lines changed

docs/api.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Arduino Modulino Library API
2+
3+
## Summary
4+
5+
Members | Descriptions
6+
--------------------------------------------|------------------------------------------
7+
| `class` [`ModulinoClass`](#modulinoclass) | The base class for all Modulino components, providing essential functionality and structure for all subsequent Modulino modules. |
8+
| `class` [`ModulinoButtons`](#modulinobuttons) | Handles the functionality of Modulino Buttons, enabling detection of presses and handling input events. |
9+
| `class` [`ModulinoBuzzer`](#modulinobuttons) |Handles the functionality of Modulino Buzzer, enabling the sound generation for feedback or alerts. |
10+
| `class` [`ModulinoPixels`](#modulinopixels) | Handles the functionality of Modulino Pixels, managing LEDs strip color, status and brightness. |
11+
| `class` [`ModulinoKnob`](#modulinoknob) | Handles the functionality of Modulino Knob, interfacing with the rotary knob position. |
12+
| `class` [`ModulinoMovement`](#modulinomovement) | Handles the functionality of Modulino Movement,interfacing with the IMU sensor to get acceleration readings. |
13+
| `class` [`ModulinoThermo`](#modulinothermo) | Handles the functionality of Modulino Thermo, managing temperature sensors to provide real-time temperature and humidity readings. |
14+
| `class` [`ModulinoPressure`](#modulinopressure) | Handles the functionality of Modulino Pressure, interfacing with pressure sensors to get atmospheric pressure. |
15+
16+
### ModulinoClass
17+
18+
The `ModulinoClass` is the main class that handles the initialization of the I2C communication bus.
19+
20+
#### Methods
21+
22+
- **`void begin(HardwareI2C& wire = Wire)`**
23+
Initializes the I2C communication. The default I2C bus is `Wire`, but you can specify another one (e.g., `Wire1`).
24+
25+
---
26+
27+
### ModulinoButtons
28+
29+
Represents a Modulino Buttons module.
30+
31+
#### Methods
32+
33+
- **`PinStatus isPressed(int index)`**
34+
Returns the press status (HIGH/LOW) of the button at the specified index (_0-A, 1-B, 2-C_).
35+
36+
- **`bool update()`**
37+
Updates the button status. Returns `true` if the status has changed, `false` otherwise.
38+
39+
- **`void setLeds(bool a, bool b, bool c)`**
40+
Sets the LED states. Each argument corresponds to one LED's state (on/off).
41+
42+
---
43+
44+
### ModulinoBuzzer
45+
46+
Represents a Modulino Buzzer module.
47+
48+
#### Methods
49+
50+
- **`void tone(size_t freq, size_t len_ms)`**
51+
Plays a tone at the specified frequency (`freq`) and duration (`len_ms`).
52+
53+
- **`void noTone()`**
54+
Stops any tone currently playing.
55+
56+
---
57+
58+
### ModulinoPixels
59+
60+
Represents a Modulino Pixels module.
61+
62+
#### Methods
63+
64+
- **`void set(int idx, ModulinoColor rgb, uint8_t brightness = 25)`**
65+
Sets the color of the LED at the specified index.
66+
67+
- **`void set(int idx, uint8_t r, uint8_t g, uint8_t b, uint8_t brightness = 5)`**
68+
Sets the color of the LED at the specified index using RGB values.
69+
70+
- **`void clear(int idx)`**
71+
Clears the LED at the specified index (turns it off).
72+
73+
- **`void clear()`**
74+
Clears all LEDs (turns them all off).
75+
76+
- **`void show()`**
77+
Updates the LEDs to display the current color data.
78+
79+
---
80+
81+
### ModulinoKnob
82+
83+
Represents a Modulino Knob module.
84+
85+
#### Methods
86+
87+
- **`int16_t get()`**
88+
Gets the current value of the knob.
89+
90+
- **`bool isPressed()`**
91+
Returns `true` if the button on the knob is pressed, `false` otherwise.
92+
93+
- **`void set(int16_t value)`**
94+
Sets the knob value.
95+
96+
---
97+
98+
### ModulinoMovement
99+
100+
Represents a Modulino Movement module.
101+
102+
#### Methods
103+
104+
- **`int update()`**
105+
Updates the sensor data and reads the acceleration values.
106+
107+
- **`int available()`**
108+
Returns `true` if acceleration data is available.
109+
110+
- **`float getX()`**
111+
Returns the X-axis acceleration.
112+
113+
- **`float getY()`**
114+
Returns the Y-axis acceleration.
115+
116+
- **`float getZ()`**
117+
Returns the Z-axis acceleration.
118+
119+
---
120+
121+
### ModulinoThermo
122+
123+
Represents a Modulino Thermo module.
124+
125+
#### Methods
126+
127+
- **`float getHumidity()`**
128+
Returns the humidity reading.
129+
130+
- **`float getTemperature()`**
131+
Returns the temperature reading.
132+
133+
---
134+
135+
### ModulinoPressure
136+
137+
Represents a Modulino Pressure module.
138+
139+
#### Methods
140+
141+
- **`float getPressure()`**
142+
Returns the pressure reading.
143+
144+
- **`float getTemperature()`**
145+
Returns the temperature reading.
146+
147+
## Constants
148+
149+
- **`ModulinoColor RED`**
150+
Represents the color red for Modulino Pixels modules.
151+
152+
- **`ModulinoColor BLUE`**
153+
Represents the color blue for Modulino Pixels modules.
154+
155+
- **`ModulinoColor GREEN`**
156+
Represents the color green for Modulino Pixels modules.
157+
158+
- **`ModulinoColor VIOLET`**
159+
Represents the color violet for Modulino Pixels modules.
160+
161+
- **`ModulinoColor WHITE`**
162+
Represents the color white for Modulino Pixels modules.
163+
164+
### ModulinoColor
165+
166+
Represents a color for Modulino Pixels modules.
167+
168+
#### Constructor
169+
170+
- **`ModulinoColor(uint8_t r, uint8_t g, uint8_t b)`**
171+
Creates a color with the specified red (`r`), green (`g`), and blue (`b`) components.
172+
173+
## License
174+
175+
This library is released under the [LGPLv2.1 license](../LICENSE).

0 commit comments

Comments
 (0)