InnoVech
Published

Lesson 3 - Blink LED

In Lesson 3, we will begin by writing a simple program on the Arduino.

IntermediateProtip1 hour3,133
Lesson 3 - Blink LED

Things used in this project

Story

Read more

Code

Blink LED

Arduino
Arduino Source Code
//Complete Guide to Arduino Basics
//Created by Zaqyas Mahmood, InnoVech
//Lesson 3 Blink LED


//Assign pin 13 a name e.g. LED
const int LED = 13;


void setup() 
{
 //initialise the serial monitor data rate at 9600bps
 Serial.begin (9600);
 //configure the digital pin as an output
 pinMode(LED, OUTPUT); 
}



void loop() 
{    
  //control the digital pin to turn the LED on
  digitalWrite(LED, HIGH);
  //receive a signal in the serial monitor to show LED is on
  Serial.println("LED is on");
  //a delay to blink the LED in 1 second intervals
  delay(1000);
  
  //control the digital pin to turn the LED off
  digitalWrite(LED, LOW);
  //receive a signal in the serial monitor to show LED is off
  Serial.println("LED is off");
  //a delay to blink the LED in 1 second intervals
  delay(1000);
}

Credits

InnoVech
11 projects • 8 followers
We strive to share our projects with engineering hobbyists and students who are driven to play their roles in the future of engineering.

Comments