Difference between revisions of "Microduino Ultrasonic ranging-OLED display distance"
(Created page with "{{Language | Microduino 超声波测距-OLED显示}} {| style="width: 800px;" |- | ==Objective== This tutorial will teach you using the ultrasonic sensor to measure distance a...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 43: | Line 43: | ||
==Debug== | ==Debug== | ||
− | Step | + | Step 1: Stack all the required Microduino module, as follows: |
[[File:Microduino超声波OLED显示连接图.jpg|600px|center|thumb]] | [[File:Microduino超声波OLED显示连接图.jpg|600px|center|thumb]] | ||
− | Step | + | Step 2: Compile the program and download it. |
− | Step | + | Step 3: Run program, put a object in front of sensor, then move it, observe the OLED's value. |
[[File:Microduino超声波OLED显示测距图.jpg|600px|center|thumb]] | [[File:Microduino超声波OLED显示测距图.jpg|600px|center|thumb]] | ||
Line 58: | Line 58: | ||
==Video== | ==Video== | ||
− | + | ||
|} | |} |
Latest revision as of 10:25, 28 September 2016
Language: | English • 中文 |
---|
ObjectiveThis tutorial will teach you using the ultrasonic sensor to measure distance and displays on Microduino OLED. Equipment
Schematic
ProgramRefer to UltrasonicOLED The following is the distance measurement algorithm: digitalWrite(TrigPin, LOW); //Send a pulse to TrigPin delayMicroseconds(2); digitalWrite(TrigPin, HIGH); delayMicroseconds(10); digitalWrite(TrigPin, LOW); cm = pulseIn(EchoPin, HIGH) / 58.0; //Convert the timer to distance (cm) (The propagation of sound speed is 340 m/s) cm = (int(cm * 100.0)) / 100.0; //Keep two decimal places
DebugStep 1: Stack all the required Microduino module, as follows: Step 2: Compile the program and download it. Step 3: Run program, put a object in front of sensor, then move it, observe the OLED's value.
ResultOLED will display the distance between sensor and object. Video |