Vibration Sensor (วัดความสั่นสะเทือน) ON/OFF
![]() กดเพื่อขยายขนาด |
|
โมดูลวัดแรงสั่นสะเทือน Vibration Sensor
* สัญาณที่ออกเป็น Digital Output 0-1 (ON/OFF) โดยมีโวลุ่มปรับระดับความแรงในการสั่นได้
รายละเอียด
SW-420 using the company's production of normally closed type vibration sensor.
The comparator output, the signal is clean, the waveform, the driving ability to exceed 15mA
Operating voltage 3.3V-5V
The output in the form: Digital switching outputs (0 and 1)
A fixed bolt hole for easy installation
Small board PCB size: 3.2cm x 1.4cm
ตัวอย่าง Source Code ที่ใช้กับ PIN Analog
void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.println(sensorValue); delay(1000); // delay in between reads for stability }
ตัวอย่าง Source Code ที่ใช้กับ PIN DIGITAL
int LED_Pin = 13; int vibr_Pin =3; void setup(){ pinMode(LED_Pin, OUTPUT); pinMode(vibr_Pin, INPUT); //set vibr_Pin input for measurment Serial.begin(9600); //init serial 9600 // Serial.println("----------------------Vibration demo------------------------"); } void loop(){ long measurement =TP_init(); delay(50); // Serial.print("measurment = "); Serial.println(measurement); if (measurement > 1000){ digitalWrite(LED_Pin, HIGH); } else{ digitalWrite(LED_Pin, LOW); } } long TP_init(){ delay(10); long measurement=pulseIn (vibr_Pin, HIGH); //wait for the pin to get HIGH and returns measurement return measurement; }

Share
สินค้าที่เกี่ยวข้อง
ไม่มีสินค้าที่เกี่ยวข้องสำหรับสินค้านี้
เขียนความคิดเห็น
ชื่อ:
ความคิดเห็น: คำแนะนำ: HTML จะไม่ถูกแปลง!
ความนิยม: แย่ ดี
ป้อนรหัสในกล่องข้างล่างนี้:

ความคิดเห็น: คำแนะนำ: HTML จะไม่ถูกแปลง!
ความนิยม: แย่ ดี
ป้อนรหัสในกล่องข้างล่างนี้: