0% found this document useful (0 votes)
11 views3 pages

Arduino Experiments

Uploaded by

Albin Manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Arduino Experiments

Uploaded by

Albin Manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Arduino Uno

Aim:

1. To blink a LED with delay of 1 second.


2. To generate square wave of different frequency.
3. To design right shift and left shift register.
4. To design a voltmeter to measure voltage from (0-5) V.

Apparatus and components required:

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);
}

// the loop function runs over and over again forever


void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
2. Program to generate square wave of different frequency.

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()
{

for (int thisPin = 0; thisPin < pinCount; thisPin++)


{
pinMode(ledPins[thisPin], OUTPUT);
}
}

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;

if (input_voltage < 0.1)


{
input_voltage=0.0;
}
Serial.print("v= ");
Serial.println(input_voltage);
}

You might also like