□️Calling the setup() function, which initializes the program and: pinMode(SoundPin, INPUT) Otherwise, the value is true, so the alarm is tampered with and a sound detected. If the value is false, the alarm was not triggered. □️Assigning the ButtonPin variable to pin 7 on the Arduino that is used to read the button status. □️Initializing to 300 the variable BuzzerFreq, which reflects the tone frequency of the buzzer. □️Assigning to pin 9 on the Arduino the BuzzerPin variable, which represents the positive terminal of the buzzer. □️The Sensitivity variable is initialized to 2 and has the minimum number of times a sound has to be detected to trigger an alarm. The SoundCount variable starts to 0, which contains the number of times the sound detector has detected a sound. □️Assigning to pin 8 on the Arduino the SoundPin variable, which represents the output pin on the sound detector. □️The RawValue variable that contains the data from the sound sensor is initialized to 0. Program int RawValue = 0 int SoundPin = 8 int SoundCount = 0 int Sensitivity = 2 int BuzzerPin = 9 int BuzzerFreq = 300 int ButtonPin = 7 boolean AlarmTripped = false void setup() Connect the other pin on the 3.3-V pin on the Arduino pushbutton.Connect the other end of the resistor with the Arduino GND pin. Connect a pin on the push button to a node with a resistor and a pin 7 wire on the Arduino.Connect the positive terminal to the Arduino pin 9 of the piezo buzzer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |