0% found this document useful (0 votes)
12 views6 pages

Arduino Collection 1

This document is a collection of Arduino project examples with explanations for various functionalities. It includes projects like blinking an LED, controlling an LED with a button, reading analog values, fading an LED using PWM, and measuring temperature with an LM35 sensor. Each example provides the necessary code and a brief description of its operation.

Uploaded by

nx119
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)
12 views6 pages

Arduino Collection 1

This document is a collection of Arduino project examples with explanations for various functionalities. It includes projects like blinking an LED, controlling an LED with a button, reading analog values, fading an LED using PWM, and measuring temperature with an LM35 sensor. Each example provides the necessary code and a brief description of its operation.

Uploaded by

nx119
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

Arduino Project Collection 1

A collection of Arduino examples with explanations.


Blink LED

int ledPin = 13;


void setup(){ pinMode(ledPin, OUTPUT); }
void loop(){
digitalWrite(ledPin, HIGH); delay(500);
digitalWrite(ledPin, LOW); delay(500);
}

Blinks an LED every 500ms using digital output.


Button Control LED

int button=2, led=13;


void setup(){
pinMode(button,INPUT);
pinMode(led,OUTPUT);
}
void loop(){
digitalWrite(led,digitalRead(button));
}

Turns LED on/off based on button state.


Analog Read

void setup(){ [Link](9600); }


void loop(){
int val=analogRead(A0);
[Link](val);
delay(500);
}

Reads analog sensor value and prints to Serial Monitor.


PWM Fade

int led=9;
void setup(){ pinMode(led,OUTPUT); }
void loop(){
for(int i=0;i<=255;i++){
analogWrite(led,i); delay(10);
}
}

Gradually increases LED brightness using PWM.


Temperature LM35

void setup(){ [Link](9600); }


void loop(){
int v=analogRead(A0);
float temp=v*(5.0/1023.0)*100;
[Link](temp);
delay(1000);
}

Reads temperature from LM35 and prints Celsius value.

You might also like