Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
OLONGAPO CAMPUS
OLONGAPO CITY
SUBMITTED BY:
DIAZ, OSMUNDO
PERMIT NUMBER: PRELIM: 00127 MIDTERM: 00129
ALMAZAN, CRISTINA
PERMIT NUMBER: 00039 MIDTERM: 00040
SUBMITTED TO:
ENGR. ALLEN JOSEPH J. HORVIDALLA
INSTRUCTOR
MARCH 24, 2015
DATE
OBJECTIVES:
1. To learn more about an Arduino functions purpose , programs and
arguments.
2.To enhance experience on actual arduino combine with other actuators .
3.To create basic and useful project and program with arduino.
PRICE
SUBTOTAL
LED
3.00
9.00
RESISTOR
1.00
4.00
SWITCH
20.00
20.00
SPEAKER
40.00
40.00
POTENTIOMETER
15.00
15.00
PCB
20.00
20.00
TOTAL: 108.00
DISCUSSION:
Arduino hardware and Software program like tone and pin selection interact with the
pcb board and into a speaker. Tone synchronize to a led every bit and by using
potentiometer you can adjust a tone volume minimum or maximum and connected with
a switch that could switch on and off.
GALLERY:
Using Arduinos hardware and software program we create a simple project, combine
with electronic parts like resistors, switch, led, speaker and potentiometer that could
give us an output into a tone or melody synchronise with the led. Arduino is an opensource electronics prototyping platform based on flexible, easy-to-use hardware and
software. It's intended for artists, designers, hobbyists, and anyone interested in creating
interactive objects or environments.
int ledState = 0;
// notes
int melody[] = {
F6, G6, Ab6, Eb6, Eb6, Bb6,
Ab6, F6, F6, F6, F6, G6, Ab6,
F6, G6, Ab6, Eb6, Eb6, C7,
Bb6, Ab6, Bb6, C7, C7, Db7, C7, Bb6, Ab6,
Eb7, C7, Bb6, Ab6, Ab6, Eb7, C7, Ab6,
Ab6, Ab6, G6, Eb6, Eb6,
C6, Db6, Db6, C6, Db6, C6, Db6, Db6, C6, Ab5 };
8,16,16,8,4,8,8,8,
8,16,16,8,4,8,8,8,
8,16,16,8,4,8,8,8,
8,2,8,8,1,
8,4,8,4,8,8,
8,8,4,8,4,8,
4,8,4,8,3
};
void setup() {
pinMode(pPin, INPUT);
pinMode(rPin, OUTPUT);
pinMode(gPin, OUTPUT);
pinMode(bPin, OUTPUT);
}
void loop() {
int pPinState=digitalRead(pPin);
if(pPinState==HIGH) {
ledState = 1;
}
if (pPinState==LOW and ledState ==1) {
ledState = 2;
ledOn = not ledOn;
}
if (ledOn && pPinState!=HIGH) {
for (int thisNote = 0; thisNote < musicLength; thisNote++) {
// blink the three LEDs in sequence
if (thisNote%3==0){
digitalWrite(rPin, HIGH);
digitalWrite(gPin, LOW);
digitalWrite(bPin, LOW);
}
else if (thisNote%3==1){
digitalWrite(rPin, LOW);
digitalWrite(gPin, HIGH);
digitalWrite(bPin, LOW);
}
else if (thisNote%3==2){
digitalWrite(rPin, LOW);
digitalWrite(gPin, LOW);
digitalWrite(bPin, HIGH);
}
// calculate the note duration. change tempo by changing 2000 to other values
int noteDuration = 2000/noteDurations[thisNote];
tone(piezoPin, melody[thisNote],noteDuration);
digitalWrite(gPin, LOW);
digitalWrite(bPin, LOW);
}
}