아두이노

진동센서

iseohyun 2022. 1. 18.

목차

    int analogpin = 0; // define analog OUT signal pin
    int analog; // define variable to store value read from pin
    int digitalpin = 2; // define digital OUT signal pin
    int digital; // define variable to store value read from pin
    
    void setup() {
    	pinMode(analogpin, INPUT); // set the OUT signal pin as an input
    	pinMode(digitalpin, INPUT); // set the OUT signal pin as an input
    	Serial.begin(9600); // launch the serial monitor
    	Serial.println("Flux Workshop Example");
    }
     
    void loop() {
    	analog = analogRead(analogpin);  // read the voltage level on the A0
    	digital = digitalRead(digitalpin);  // read the voltage level on the D2
    	Serial.println((String)"Light level: Analog " + analog + " Digital " + digital ); // send the result to the serial monitor
    	delay(200); // pause for a moment before repeating
    }

    https://fluxworkshop.com/blogs/getting-started/lets-workshop-keyes-801s-vibration-sensor-module

     

    Let's Workshop: Keyes 801S Vibration Sensor Module

    Here is a quick introduction to using the Keyes 801S based vibration sensor. Hopefully it will provide you with the confidence to integrate knock and vibration sensing into your project. This example will demonstrate the use of an Arduino UNO in monitoring

    fluxworkshop.com

     

    '아두이노' 카테고리의 다른 글

    고감도 마이크(KY-036)  (0) 2022.01.18
    릴레이  (0) 2022.01.18
    적외선 센서  (0) 2022.01.17
    레이저  (0) 2022.01.17
    3색 LED  (0) 2022.01.17

    댓글