Operácie

Acrob003

Z SensorWiki

Verzia z 07:21, 12. jún 2010, ktorú vytvoril Balogh (diskusia | príspevky) (Nová stránka: == LED blink == right Your board contains one user programmable LED diode (see schematic). Let's try to controll it using the followng programm...)
(rozdiel) ← Staršia verzia | Aktuálna úprava (rozdiel) | Novšia verzia → (rozdiel)

LED blink

ArduinoLEDExample.png


Your board contains one user programmable LED diode (see schematic). Let's try to controll it using the followng programm:

#define LED_Yellow 13                // select the pin for LED

void setup()
{
 pinMode(LED_Yellow, OUTPUT );       // this pin is an OUTPUT
}

void loop() // endless loop
{
 digitalWrite(LED_Yellow, HIGH);    // make it visible
 delay(1000);                       // wait 1000 ms = 1s
 digitalWrite(LED_Yellow, LOW);     // turn off
 delay(1000);                       // wait again
}

How it works

Your turn

Connect Your own LED on the experimental breadboard. Connect the LED to the pin D2, it will be assigned with number 2 in Your program digitalWrite(2,HIGH).

ArduinoLEDconnection.png

Change the program to blink with both LEDs - Your and the onboard. Can You program them tu blink mutually like on the railway crosses?


< Previous | Home | Next >