0% found this document useful (0 votes)
31 views

Arduino Project

Ms. Ivy Bacolongan

Uploaded by

Ivy Bacolongan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Arduino Project

Ms. Ivy Bacolongan

Uploaded by

Ivy Bacolongan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Certificate No.

AJA19-0226

“Compilation project”

1. Blink a LED
2. Fading a LED
3. Fading LED w/ photoresistor
4. Potentiometer
5. Blinking LED using switch
6. Servo
7. Tone Melody (Despacito)
8. Bar Graph
9. Scrolling LED
10. LCD Monitor
Certificate No. AJA19-0226

Lab #1:

BLINKED A LED

CODE:

int led = 13;

void setup() {

pinMode(led, OUTPUT);

void loop()

digitalWrite(led, HIGH);

delay(1000);

digitalWrite(led, LOW);

delay(1000);

}
Certificate No. AJA19-0226

Lab #2:

FADING A LED

CODE:

int led = 9

int brightness = 0;

int fadeAmount = 5;

void setup() {

pinMode(led, OUTPUT);}

void loop() {

analogWrite(led, brightness);

brightness = brightness + fadeAmount;

if (brightness <= 0 || brightness >= 255) {

fadeAmount = -fadeAmount;}

delay(30);

}
Certificate No. AJA19-0226

Lab # 3:

FADING LED W/ PHOTORESISTOR

CODE:

int ledPin = 3;

int photocellInput = 0;

void setup() {

pinMode(ledPin, OUTPUT);

void loop() {

photocellInput = (analogRead(0)/4);

analogWrite(ledPin, photocellInput);

delay(20);

}
Certificate No. AJA19-0226
Lab#4:

POTENTIOMETER

CODE:

int potPin = 2;

int ledPin = 13;

int val = 0;

void setup() {

pinMode(ledPin, OUTPUT);

void loop() {

val = analogRead(potPin);

digitalWrite(ledPin, HIGH);

delay(val);

digitalWrite(ledPin, LOW);

delay(val);{
Certificate No. AJA19-0226

Lab#5:

BLINKING LED USING SWICTH

CODE:

const int switchPin = 4;

const int ledPin = 8;

int switchState = 0;

void setup(){

pinMode(ledPin, OUTPUT);

pinMode(switchPin, INPUT_PULLUP);

void loop(){

switchState = digitalRead(switchPin);

if (switchState == LOW){

digitalWrite(ledPin, HIGH);

delay(3000);

digitalWrite(ledPin, LOW);

}
Certificate No. AJA19-0226
Lab #6

SERVO

CODE:

Servo servo_test;

int angle = 0;

void setup(){

servo_test.attach(9); }

void loop(){

for(angle = 0; angle < 180; angle += 1){

servo_test.write(angle);

delay(15); }

delay(1000);

for(angle = 180; angle>=1; angle-=5){

servo_test.write(angle);

delay(5); }

delay(1000);}
Certificate No. AJA19-0226

Lab# 7:

TONE MELODY (DESPACITO)

CODE:
delay(negra/4); digitalWrite(led3, HIGH);
#include "pitches.h" digitalWrite(led1, HIGH);
int digitalWrite(led2, LOW);// (3)
led1=5
notars(negra/4, NOTE_FS4);
notars(negra/4, NOTE_FS4);
int led2=6; notars(negra, NOTE_D5);
int led3=7;
notars(negra,
NOTE_CS5);digitalWrite(led1, HIGH); int noteDuration;
digitalWrite(led3, HIGH); int pauseBetweenNotes = 0;
digitalWrite(led2, LOW);// (1) int negra;
notars(negra/2, NOTE_B4); void setup() {
notars(negra/4, pinMode(led1, OUTPUT);
NOTE_FS4);digitalWrite(led1, LOW);
pinMode(led2, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led3, OUTPUT);
digitalWrite(led2, HIGH);
Certificate No. AJA19-0226

Lab# 8:

BAR GRAPH

CODE:

const int analogPin = A0;

const int ledCount = 10;

int ledPins[] = {1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

void setup() {

for (int thisLed = 0; thisLed < ledCount; thisLed++) {

pinMode(ledPins[thisLed], OUTPUT);{

int sensorReading = analogRead(analogPin);

int ledLevel = map(sensorReading, 0, 1023, 0, ledCount);

for (int thisLed = 0; thisLed < ledCount; thisLed++) {

if (thisLed < ledLevel) {

digitalWrite(ledPins[thisLed], HIGH);
}else {

digitalWrite(ledPins[thisLed], LOW);
Certificate No. AJA19-0226
}}}
Certificate No. AJA19-0226
Lab# 9:

SCROLLING LED

CODE:

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;


LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
lcd.print("hello, world!");
delay(1000);}
void loop() {
for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
lcd.scrollDisplayLeft(); delay(150); }
for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
lcd.scrollDisplayRight();
delay(150); }
for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
lcd.scrollDisplayLeft();
delay(150);
delay(1000)}
Certificate No. AJA19-0226
Lab# 10:

LCD MONITOR

CODE:

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup(){

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a mes#include <LiquidCrystal.h>

sage to the LCD.

lcd.print("Hello World!");

}// initialize the library with the numbers of the interface pins

void loop()

{lcd.setCursor(0, 1);

lcd.print("Codebender");
{
Certificate No. AJA19-0226

BASIC ARDUINO MODULE

Group Member: Mark Julius Mingollo


Salvin Diana
Errol Cebrero
Von Billy Taninas
Arjay Jataas
Melvin Legria

Insert: Abegail Sabijon


Jackylyn Oblino

BSIT-2A
ADVISER: Ivy Bacolongan

You might also like