Ultra sound HC-SR-04, ESP8266 with OLED showing wave pattern distance
ฝัง
- เผยแพร่เมื่อ 5 ก.พ. 2025
- Key Features of the Code
measureDistance: Measures the distance using the HC-SR04.
updateWaveData: Updates the wave array to shift older data left and add new distance data.
drawWave: Draws the wave on the OLED by connecting points with lines.
Steps to Visualize the Wave
Read Distance: Continuously measure the distance using the HC-SR04 sensor.
Map the Data: Map the measured distance to fit the vertical resolution of the OLED display (e.g., 0-64 for a 128x64 OLED).
Update the Display: Plot the mapped data as a wave on the OLED display by:
Shifting the previous wave data left.
Adding the new data point at the rightmost column.
Code:
github.com/ukk...