Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6104

C/C++ • HC-SR04 Ultrasonic sensor C++ code errors on even number reads

$
0
0
Hi All
Excuse any faults please as very much a beginner here :))

Raspberry Pi CM4 running latest OS from USB
Connected via a level shifter to the HC-SR04 Ultrasonic sensor

Python code reads every time = so circuit is correct (I assume :)
C++ Code (using WiringPi library - latest) fails on the even number of reads, but odd number reads ok.

Does the C Code need a GPIO reset or clear down between reads
OR is it something else?

Steve

Statistics: Posted by sgreensides — Thu Apr 11, 2024 9:42 am



Viewing all articles
Browse latest Browse all 6104

Latest Images

Trending Articles



Latest Images