forked from arduino-libraries/Modulino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasic.ino
36 lines (32 loc) · 822 Bytes
/
Basic.ino
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
/*
* Modulino Buttons - Basic
*
* This example code is in the public domain.
* Copyright (c) 2025 Arduino
* SPDX-License-Identifier: MPL-2.0
*/
#include <Modulino.h>
ModulinoButtons buttons;
bool button_a = false;
bool button_b = false;
bool button_c = false;
void setup() {
Serial.begin(9600);
Modulino.begin();
buttons.begin();
//function to control the LEDs on top of each button
buttons.setLeds(true, true, true);
}
void loop() {
//request new data from the Modulino buttons
if (buttons.update()) {
//Check if the buttons has been pressed
if (buttons.isPressed(0)) {
Serial.println("Button A pressed!");
} else if (buttons.isPressed(1)) {
Serial.println("Button B pressed!");
} else if (buttons.isPressed(2)) {
Serial.println("Button C pressed!");
}
}
}