Learning to code with Arduino

  • Lesson 1, leds with a delay

    During the second week of April in Spain, we were doing our first step with the Arduino board by writing some basics programs with two or three leds blinking, as you can see in this video:

    THIS IS A POSSIBLE SOLUTION FOR THE CODE

    void setup() {
      // initialize digital pins 13 and pin 10 as an output.
      pinMode(13, OUTPUT);
      pinMode(10, OUTPUT);
    }

    // the loop function runs over and over again forever
    void loop() {
      digitalWrite(13, HIGH);   //(HIGH is the voltage level)
      digitalWrite(10, LOW); // turn the LED 13 on and the LED 10 off                     
      delay(300);              // wait for 300 millisecond
      digitalWrite(13, LOW);
      digitalWrite(10, HIGH); // alternative ligthning
      delay(300);              
    }