clignotante.ino
A first program to check the board works: the built-in LED on pin 13 blinks once per second. The code uses millis() instead of delay() to stay responsive, and prints each state change to the serial monitor at 9600 baud.
Hardware
An Arduino Uno R3 (ATmega328P, 5 V, 16 MHz) powered over USB or a 7-12 V barrel jack. No external component needed, the onboard LED is enough.
Wiring
Nothing to wire: the user LED is already tied to pin 13 (through an internal resistor).
How it works
The loop compares millis() (ms since boot) with the last toggle. Every second the pin state is flipped with digitalWrite and a message is sent to the serial port.
Running it
In the Arduino IDE, select the « Arduino Uno » board and the matching serial port, then click Upload. Open the serial monitor at 9600 baud to follow the messages.
Variants
Replace millis() with delay(500) for a simpler version, or wire an external LED with a 330 Ω resistor on another pin.
clignotante.ino
// Clignotement de la LED intégrée (broche 13 sur la plupart des cartes Arduino).
const int LED = 13; // LED_BUILTIN est aussi définie par le core
const long PERIODE = 1000; // ms entre deux changements d'état
bool etat = false;
unsigned long dernierChangement = 0;
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(9600);
Serial.println(F("Clignotement demarre"));
}
void loop() {
unsigned long maintenant = millis();
if (maintenant - dernierChangement >= PERIODE) {
dernierChangement = maintenant;
etat = !etat;
digitalWrite(LED, etat ? HIGH : LOW);
Serial.println(etat ? F("LED ON") : F("LED OFF"));
}
// millis() et non delay() : la boucle reste libre pour d'autres taches.
}