Skip to content

Example Buttons

Nick Tracy edited this page Jul 18, 2026 · 3 revisions

Example: Buttons

Goal: Move between two on-screen buttons with the keyboard, toggle the built-in LED, and optionally click with a mouse.

This is the best example for learning real interaction.

Setup

  1. Upload ButtonsExample.
  2. Terminal at 9600 baud.
  3. Watch the board’s built-in LED (usually next to pin 13 on classic Arduinos).

What you should see

  • Title: Button interaction example
  • Two controls: Toggle LED and Exit (one highlighted)
  • Hints about keyboard and mouse
  • Status line when the LED changes (LED is ON / OFF)

How to interact

Key / action Result
↑ / ↓ / ← / → Move the highlight
Enter Activate the highlighted button
Mouse click on a button Activate that button (only if the terminal sends mouse reports)

Toggle LED flips the onboard LED. Exit clears the screen and prints Goodbye.

PuTTY note

PuTTY over a USB serial port usually cannot click buttons. Use the arrow keys and Enter — the sketch is written for that.

Tips

  • If arrows do nothing, confirm the terminal is focused and not capturing keys for its own menus.
  • After Exit, upload again (or reset the board) to restart the sketch.

Clone this wiki locally