Materials
- Xiao RP2040 $4.68
- LED $0.20
- Resistors (100Ω, and 10kΩ) $0.01 ea
- Push Button $0.92
Software
- KiCAD
- Wokwi
const int LED_PIN = 2;
const int BUTTON_PIN = 3;
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT);
}
void loop() {
int buttonState = digitalRead(BUTTON_PIN);
if (buttonState == LOW) {
digitalWrite(LED_PIN, HIGH);
} else {
digitalWrite(LED_PIN, LOW);
}
delay(100);
}