microcontrollers
pins
- GPIO: digital HIGH/LOW; many have PWM
- ADC: analog in (e.g., 0–3.3 V → 0–4095)
- UART / I²C / SPI: talk to chips & sensors
// Arduino button → LED (pull-up)
const int LED = 5, BTN = 2;
void setup() {
pinMode(LED, OUTPUT);
pinMode(BTN, INPUT_PULLUP);
}
void loop() {
digitalWrite(LED, !digitalRead(BTN));
}
caution
mind logic levels (3.3 V vs 5 V). add level shifters where needed. try this
start with serial prints; logging is the fastest debugger.