Operácie

Acrob003: Rozdiel medzi revíziami

Z SensorWiki

(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...)
 
(How it works)
Riadok 24: Riadok 24:
  
 
=== How it works ===
 
=== How it works ===
 +
 +
 +
It is necessary to determine whether the certain pin will be configured as an INPUT or OUTPUT one. This is done in Setup section using the command <TT>
  
 
=== Your turn ===
 
=== Your turn ===

Verzia zo dňa a času 09:00, 12. jún 2010

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

It is necessary to determine whether the certain pin will be configured as an INPUT or OUTPUT one. This is done in Setup section using the command

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 >