Arduino Experiments
Arduino Experiments
Aim:
Arduino Board, Personal computer, Cathode Ray Oscilloscope, Power supply, resistors, LED.
Theory:
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino
boards are capable of reading input from sensor and activating a motor or turning on a LED. Arduino
board uses Atmega 328 microcontroller chip for performing various application. The Atmega 328 has
32k of flash memory and 2k of internal SRAM.
1. Program to blink a LED with delay of 1 second.
void setup()
{
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
void setup()
{
// put your setup code here, to run once:
pinMode(2,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(2,HIGH);
delayMicro(30);
digitalWrite(2,LOW);
delayMicro(30);
}
3. Program to design right shift and left shift register.
int timer = 1000; // The higher the number, the slower the timing.
int ledPins[] = { 2, 3, 4, 5,}; // an array of pin numbers to which LEDs are attached
int pinCount = 5; // the number of pins (i.e. the length of the array)
void setup()
{
void loop()
{
for (int thisPin = 0; thisPin < pinCount; thisPin++)
{
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);
}
4. Program to design a voltmeter to measure voltage from (0-5) V.
float input_voltage = 0.0;
float temp=0.0;
void setup() {
// put your setup code here, to run once:
pinMode(A0,INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int analog_value = analogRead(A0);
input_voltage = (analog_value * 5.0) / 1024.0;