@@ -16,31 +16,31 @@ bool button_b = true;
1616bool button_c = true ;
1717
1818void setup () {
19- Serial.begin (9600 );
20- // Initialize Modulino I2C communication
21- Modulino.begin ();
22- // Detect and connect to buttons module
23- buttons.begin ();
24- // Turn on the LEDs above buttons A, B, and C
25- buttons.setLeds (true , true , true );
19+ Serial.begin (9600 );
20+ // Initialize Modulino I2C communication
21+ Modulino.begin ();
22+ // Detect and connect to buttons module
23+ buttons.begin ();
24+ // Turn on the LEDs above buttons A, B, and C
25+ buttons.setLeds (true , true , true );
2626}
2727void loop () {
28- // Check for new button events, returns true when button state changes
29- if (buttons.update ()) {
28+ // Check for new button events, returns true when button state changes
29+ if (buttons.update ()) {
3030 // Check which button was pressed (0=A, 1=B, 2=C)
3131 // Also toggle the corresponding LED, for each of the three buttons
3232 if (buttons.isPressed (0 )) {
33- Serial.println (" Button A pressed!" );
34- button_a = !button_a;
33+ Serial.println (" Button A pressed!" );
34+ button_a = !button_a;
3535 } else if (buttons.isPressed (1 )) {
36- Serial.println (" Button B pressed!" );
37- button_b = !button_b;
36+ Serial.println (" Button B pressed!" );
37+ button_b = !button_b;
3838 } else if (buttons.isPressed (2 )) {
39- Serial.println (" Button C pressed!" );
40- button_c = !button_c;
39+ Serial.println (" Button C pressed!" );
40+ button_c = !button_c;
4141 }
42-
42+
4343 // Update the LEDs above buttons, depending on the variables value
4444 buttons.setLeds (button_a, button_b, button_c);
45- }
45+ }
4646}
0 commit comments