![]() In this instance, the sensor was held still then tapped wildly for a few moments. #PIEZO VIBRATION SENSOR SERIAL#With the board loaded with the program and all the connections made the serial monitor will produce an output like the one seen below. Serial.println((String)"Vibration level: " + analogA) // send the result to the serial monitorĭelay(200) // pause for a moment before repeating ![]() Serial.begin(9600) // launch the serial monitorĪnalogA = analogRead(analogApin) // read the voltage level on the A0 PinMode(analogApin, INPUT) // set the OUT signal pin as an input Int analogA // define variable to store value read from pin Int analogApin = 0 // define OUT signal pin The program monitors a connected analog pin and outputs the value to the Load the code below into the Arduino IDE and upload it to your board.Ī simple program designed to setup and demonstrate the Keyes Piezo Vibration Sensor Module - BDAA100022. Following that we send it to the serial monitor so that the value can be read on the screen. Next we enter the loop, where the value on the pin is read and stored in the variable declared earlier. A setup informs the system that the pin is an input is an input and then launches the serial connection. This allows easier use later in your program. First the A0 pin is assigned followed by a variable to store the value read. The code consists of a definition, setup and loop. Wire the two boards to the Arduino as can be seen in the images below, taking care to match the pin numbers and names. 3pcs Male to Male Jumper Cables - GBAA100001.1pcs Keyes Vibration Sensor Module - BDAA100022.1pcs Arduino UNO or Compatible - LCAA100005.This example will demonstrate the use of an Arduino UNO in monitoring an analog pin state as the sensor plate is manipulated. Hopefully it will provide you with the confidence to start monitoring that banging in the attic. Here is a quick introduction to using the Keyes piezo vibration sensor module. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |