Mechatronics LAB
Published © Apache-2.0

Arduino Workshop-Piezo Sounder Alarm

Today in this project we are going to create a wailing alarm sound, By connecting a piezo sounder to a digital output pin this is very, this

BeginnerFull instructions provided1 hour2,476
Arduino Workshop-Piezo Sounder Alarm

Things used in this project

Story

Read more

Schematics

Arduino Workshop-Piezo Sounder Alarm

Code

Code snippet #1

Plain text
float sinVal;
int toneVal;
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
for (int x=0; x<180; x++) {
// convert degrees to radians then obtain sin value
sinVal = (sin(x*(3.1412/180)));
// generate a frequency from the sin value
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
delay(2);
}
}

Credits

Mechatronics LAB

Mechatronics LAB

75 projects • 44 followers
I am Sarful , I am a Mechatronics Engineer & also a teacher I am Interested in the evolution of technology in the automation industry .

Comments