Nano RP2040 button
A pushbutton on D2 of the Nano RP2040 Connect lights the LED on D13, with the RP2040’s own pull-up and the Nano’s pin names. The whole build, an Arduino Nano RP2040 Connect and 1 more part, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner Runs in your browser. Free, and no account needed.
The parts retail for about $34. On Mokxi they're free.
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// Button: a pushbutton on D2 lights the LED on D13.
//
// INPUT_PULLUP switches on the pad's pull-up, so D2 sits at 3.3 V until the
// button pulls it to GND and reads LOW while it is held. D2 is GPIO 25.
const int BUTTON = D2;
void setup() {
pinMode(BUTTON, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, digitalRead(BUTTON) == LOW ? HIGH : LOW);
delay(5);
}
Parts list
3 parts, plus the jumper wires. They retail for about $34; on Mokxi they're free.
How it is wired
2 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Ground: Arduino Nano RP2040 Connect pin GND; Pushbutton pin 2b
- Arduino Nano RP2040 Connect pin D2; Pushbutton pin 1a
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.