File tree 1 file changed +13
-12
lines changed
libraries/Esplora/examples/Experts/EsploraPong
1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 22
22
#include < Esplora.h>
23
23
24
24
void setup () {
25
- Serial.begin (9600 );
25
+ Serial.begin (9600 ); // initialize serial communication
26
26
}
27
27
28
28
void loop () {
29
+ // read the slider and three of the buttons
29
30
int slider = Esplora.readSlider ();
30
- int resetButton = Esplora.readButton (1 );
31
- int serveButton = Esplora.readButton (3 );
32
- int switchPlayerButton = Esplora.readButton (4 );
31
+ int resetButton = Esplora.readButton (SWITCH_1 );
32
+ int serveButton = Esplora.readButton (SWITCH_3 );
33
+ int switchPlayerButton = Esplora.readButton (SWITCH_4 );
33
34
34
- Serial.print (slider);
35
- Serial.print (" ," );
36
- Serial.print (resetButton);
37
- Serial.print (" ," );
38
- Serial.print (serveButton);
39
- Serial.print (" ," );
40
- Serial.println (switchPlayerButton);
41
- delay (10 );
35
+ Serial.print (slider); // print the slider value
36
+ Serial.print (" ," ); // add a comma
37
+ Serial.print (resetButton); // print the reset button value
38
+ Serial.print (" ," ); // add another comma
39
+ Serial.print (serveButton); // print the serve button value
40
+ Serial.print (" ," ); // add another comma
41
+ Serial.println (switchPlayerButton); // print the last button with a newline
42
+ delay (10 ); // delay before sending the next set
42
43
}
43
44
You can’t perform that action at this time.
0 commit comments