Task 4: Lets create our first circuit using an LED, resistor and some jumper wires.

Required components:

• Arduino project board

• 1 LED of any color

• 1 220ohm resistor

• 2 jumper wires



Time to write the sketch in our Arduino IDE


// Lesson2 digitalWrite

int ledPin = 3;
int dt = 1000;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(ledPin, HIGH);
  delay(dt);
  digitalWrite(ledPin, LOW);
  delay(dt);
}