Tuesday 9 May 2017

Arduino Basics

1. Arduino Testing

Here, We are going test the Arduino by using a program its name is "Arduino blinking". we are testing Arduino by blinking its L1 SMD led which is corresponding to pin 13.

Procedure

Just connect Arduino with your pc or laptop and upload following program.

Program

/* This program is to test the Arduino*/
const int led=13;

void setup()
{
  // put your setup code here, to run once:
  pinMode(led,OUTPUT); //declaring pin 13 as Output
}

void loop()
{
  // put your main code here, to run repeatedly:
  digitalWrite(led,HIGH); // led blink
  delay(1000); //make delay for one second
  // led off time
  digitalWrite(led,LOW); //led will got off
  delay(1000);  // delay for one second

}

Video



2. Arduino blinking an external LED

Here, I am going to blink an external led and practicing the function digitalWrite(). we reacquired one led has rating of 5V and 220 ohm resistance which is connecting to reduce the current flowing through the led. An arduino pin carry only 20 ma current.

Hardware Required

1. Arduino UNO ; 1pcs.
2. Jumper wire  : 2pcs.
3 Led : 1pcs
4 Resistance 220 ohm : 1pcs.

Image showing circuit diagram



Connect pin 13 to anode of led (Anode of led is the longest pin), connect 220 ohm resistance with cathode. one end of resistance connect to ground

Video


Program


/* This program is to blink an led with an Arduino*/
const int led=13;//led connect with this pin

void setup()
{
  // put your setup code here, to run once:
  pinMode(led,OUTPUT); //declaring pin 13 as Output
}

void loop()
{
  // put your main code here, to run repeatedly:
  digitalWrite(led,HIGH); // led blink
  delay(1000); //make delay for one second
  // led off time
  digitalWrite(led,LOW); //led will got off
  delay(1000);  // delay for one second

}






No comments:

Post a Comment