BoldizarF / ariot19

Other
0 stars 0 forks source link

Attach and implement IR-sensor to car #23

Open BoldizarF opened 5 years ago

ddjohn commented 5 years ago

Component: HC-SR04 (ultrasonic distance sensor) Library: https://www.arduinolibraries.info/libraries/hcsr04 Alternative: HRSR04 by Martin Soic (in Arduino Studio) Distance: 2-400 cm

Pins: Vcc - 5V Trig - Se below Echo - See below Gnd - Gnd

UltraSonicDistanceSensor distanceSensor(triggerPin, echoPin);
double distance = distanceSensor.measureDistanceCm();
platisd commented 5 years ago

For non-blocking ultrasonic sensor measurements I'd suggest the NewPing library. For blocking measurements though, I'd naturally strongly recommend the SR04 class of the Smartcar library as it will not block up to 2 seconds if no obstacle was "seen" by the sensor. :penguin: