Skip to content

Commit fb87c81

Browse files
committed
Added comments for EsploraPong
1 parent fbd488e commit fb87c81

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Diff for: libraries/Esplora/examples/Experts/EsploraPong/EsploraPong.ino

+13-12
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,23 @@
2222
#include <Esplora.h>
2323

2424
void setup() {
25-
Serial.begin(9600);
25+
Serial.begin(9600); // initialize serial communication
2626
}
2727

2828
void loop() {
29+
// read the slider and three of the buttons
2930
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);
3334

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
4243
}
4344

0 commit comments

Comments
 (0)