Midterm projects, Analog output
The sensor used: ELEGOO 5PCS HC-SR04 Ultrasonic Module Distance Sensor
for Arduino UNO MEGA2560 Nano Robot XBee ZigBee
Making sure the ultrasonic module distance sensor is connected and reading:
P5: https://editor.p5js.org/
function draw() {
background(255);
let safetyDistance = parseInt(latestData);
if (safetyDistance <= 50) {
background(random(255), random(255), 255);
} else {}
}
Resource link:
https://www.elithecomputerguy.com/2019/06/hc-sr04-ultrasonic-distance-sensor-audio-alert-with-arduino/
https://www.elithecomputerguy.com/2019/06/hc-sr04-ultrasonic-distance-sensor-audio-alert-with-arduino/
Comments
Post a Comment