0% found this document useful (0 votes)
14 views4 pages

Control Activity 4

This document summarizes an experiment using an Arduino board to relate the resistance of a potentiometer to the frequency of a buzzer. The objective is to write a program that maps the potentiometer value to a frequency range of the buzzer, such that turning the potentiometer clockwise increases the beeping frequency. The materials used are an Arduino board, breadboard, jumper wires, buzzer, and 10kΩ potentiometer. The program uses analogRead() to read the potentiometer value, maps it to a frequency range using map(), and uses delay() and digitalWrite() to turn the buzzer on and off to produce the beeping sound.

Uploaded by

Ivan
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)
14 views4 pages

Control Activity 4

This document summarizes an experiment using an Arduino board to relate the resistance of a potentiometer to the frequency of a buzzer. The objective is to write a program that maps the potentiometer value to a frequency range of the buzzer, such that turning the potentiometer clockwise increases the beeping frequency. The materials used are an Arduino board, breadboard, jumper wires, buzzer, and 10kΩ potentiometer. The program uses analogRead() to read the potentiometer value, maps it to a frequency range using map(), and uses delay() and digitalWrite() to turn the buzzer on and off to produce the beeping sound.

Uploaded by

Ivan
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/ 4

Adamson University

Mechanical Engineering Department

Name: Ochava, Jocel Ivan B. Subject/Section: 57038


Instructor: Engr. Tony Doroliat Date Submitted: November 7, 2023

Experiment/Activity No. 4
Reading From an Analog Input Device
Objective/s:
1. Relate an output to a specified analog input
2. Write a program integrating input and output devices using Arduino IDE
3. Implement a simple application using embedded system

Materials: Arduino board, breadboard, jumper wires, active buzzer, and 10 kΩ-potentiometer.

Direction: Using Arduino IDE, write a program and implement a system that maps the
frequency of the sound of a buzzer to the resistance of the potentiometer. As the potentiometer is
turned clockwise the beeping sound gets faster.

A. Programming
Write the code and append a comment that describes the purpose of each line of code.
int buzzerPin = 2; // digital pin connected to the buzzer at pin 2
int potRead = A0; // analog pin connected to the potentiometer
float potVal; // set potVal as value that can store decimal numbers
int DT; // set DT as an integer
void setup(){

Serial.begin(9600); // sets it to exchange data with the serial monitor at 9600 bits per second

pinMode (potRead, INPUT); // configures potRead as input


pinMode (buzzerPin, OUTPUT); //configures buzzerPin as output
}
void loop(){

potVal = analogRead(potRead); // read the potentiometer value (0-1023)


DT = map(potVal, 0, 1023, 100, 500);// Map the potentiometer value to a frequency range
digitalWrite(buzzerPin, HIGH); // allows the buzzer to turn on
delay(DT); // inputs delay depending on DT
digitalWrite(buzzerPin, LOW); // allows the buzzer to turn off
delay(DT); // inputs delay depending on DT
Serial.println(DT); // prints delay time to serial monitor

B. Wiring Connection (Note: this must be hand drawn)


C. System Implementation

D. Discussion and Conclusion

______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
_____________________________________________________________________________

You might also like