Light the LEDs up, one by another...

Now, let's try to create a program with four LEDs that they will be turned on and after a while they will be turned off in a row.

First of all, we connect the LEDs, the cables and the NodeMCU on the breadboard, according to the following picture (you can use any cable color you like, not only the ones that are displayed below):


As we notice, we use pins D0, D1, D2, and D3, or pins 16, 5, 4 and 0 if we talk in Arduino IDE language! 


So we have to declare them as output pins and then digitalWrite() them high or low, using a delay after any of these commands.

Then, we copy the following code to the Arduino IDE and upload our program:

void setup() {
   pinMode(16, OUTPUT);
   pinMode(5, OUTPUT);
   pinMode(4, OUTPUT);
   pinMode(0, OUTPUT);
}


void loop() {
  digitalWrite(16, HIGH);
  delay(200);
  digitalWrite(5, HIGH);
  delay(200);      
  digitalWrite(4, HIGH);
  delay(200);
  digitalWrite(0, HIGH);
  delay(200); 
  digitalWrite(16, LOW);
  delay(300);
  digitalWrite(5, LOW);
  delay(300);
  digitalWrite(4, LOW);
  delay(300);
  digitalWrite(0, LOW);
  delay(300);
}

Are we happy by the result?
Now think about, how can we add more LEDs and what should we do if we want to make them light on and off faster? What is the maximum amount of LEDs that we can handle?
Experiment, play, enjoy!