aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/test-session.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/examples/test-session.cpp b/examples/test-session.cpp
index 01d0fe9..03fb248 100644
--- a/examples/test-session.cpp
+++ b/examples/test-session.cpp
@@ -29,6 +29,7 @@ void cmd_sequential_adc_reads(void);
void cmd_gpio_qa(void);
void cmd_sequential_gpio_writes(void);
void cmd_gpio_toggling(void);
+void cmd_but_test(void);
void cmd_sequential_pwm_test(void);
void cmd_servo_sweep(void);
void cmd_board_info(void);
@@ -73,7 +74,7 @@ void setup() {
void loop () {
toggleLED();
- delay(100);
+ delay(250);
while (SerialUSB.available()) {
uint8 input = SerialUSB.read();
@@ -154,6 +155,10 @@ void loop () {
cmd_gpio_toggling();
break;
+ case 'B':
+ cmd_but_test();
+ break;
+
case 'f':
SerialUSB.println("Wiggling D4 as fast as possible in bursts. "
"Press any key.");
@@ -261,6 +266,7 @@ void cmd_print_help(void) {
SerialUSB.println("\tU: dump data as fast as possible on USB");
SerialUSB.println("\tg: toggle GPIOs sequentially");
SerialUSB.println("\tG: toggle GPIOs at the same time");
+ SerialUSB.println("\tB: test the built-in button");
SerialUSB.println("\tf: toggle pin 4 as fast as possible in bursts");
SerialUSB.println("\tr: monitor and print GPIO status changes");
SerialUSB.println("\ts: output a sweeping servo PWM on all PWM channels");
@@ -577,6 +583,20 @@ void cmd_gpio_toggling(void) {
}
}
+void cmd_but_test(void) {
+ SerialUSB.println("Press the button to test. Press any key to stop.");
+ pinMode(BOARD_BUTTON_PIN, INPUT);
+
+ while (!SerialUSB.available()) {
+ if (isButtonPressed()) {
+ uint32 tstamp = millis();
+ SerialUSB.print("Button press detected, timestamp: ");
+ SerialUSB.println(tstamp);
+ }
+ }
+ SerialUSB.read();
+}
+
void cmd_sequential_pwm_test(void) {
SerialUSB.println("Sequentially testing PWM on all unused pins. "
"Press any key for next pin, ESC to stop.");