OBTAINING DIGITAL OUTPUT FROM ARDUINO(UNO)
Most of the Arduino project we come across are based on digital output. So, here are some simple exercises to demonstrate how digital output can be obtained from arduino. We are using the most commonly used Arduino Uno for the purpose. The outputs are taken from the Digital I/O pins but barring the PWM pins just for the sake of convention. We are using Pins 2, 4, 7 here. As we are using bread board, the GND has been supplied to the ground channel of the breadboard. 1K resistors have been used in series with the LEDs to protect them from burnout.
A sample sketch is provided below which can be modified as per requirement to do all the exercises shown here:-
BLINKING LEDs-
const int LEDa = 2 ;
const int LEDb = 4 ;
const int LEDc = 7 ;
void setup ()
{
pinMode ( LEDa , OUTPUT );
pinMode ( LEDb , OUTPUT ) ;
pinMode ( LEDc , OUTPUT ) ;
}
void loop ()
{
digitalWrite (LEDa , 1 );
digitalWrite (LEDb,1);
digitalWrite (LEDc , 1 );
delay (1000);
digitalWrite (LEDa, 0 );
digitalWrite (LEDb, 0);
digitalWrite (LEDc , 0 );
delay (1000);
}
Comments
Post a Comment