Blink an LED
Arduino UNO (Kuman UNO)
Électronique / Electronic

Pin

Vin = +9V bat whit on/off button
GND in = - of bat

GND Out to GND 220R
Pin 13 to +LED

Code:

/*
Turn an LED on for one second, off for one second, and repeat forever.
*/

void setup()
{
pinMode(13, OUTPUT);
}

void loop()
{
digitalWrite(13, HIGH); // Turn on the LED
delay(1000); // Wait for one second
digitalWrite(13, LOW); // Turn off the LED
delay(1000); // Wait for one second
}
/*
/ Try changing the 1000 in the above delay() functions to
/ different numbers and see how it affects the timing. Smaller
/ values will make the loop run faster.
/
/ Other challenges:
/ * Decrease the delay to 10 ms. Can you still see it blink?
/ Find the smallest delay that you can still see a blink. What is this frequency?
/ * Modify the code above to resemble a heartbeat.
*/

 

 

 

 

 

 

Recherche personnalisée