I have an ultrasonic sensor that I haven’t touched for a couple years and when I use the following code to get the sensor readings the value won’t change its reads a long number that doesn’t change.
adi_ultrasonic_t ult = adi_ultrasonic_init(PORT_PING, PORT_ECHO);
int dist = (int)(adi_ultrasonic_get(ult));
I get the following error:
Compiled src/main.c [ERRORS]
src/main.c: In function ‘delayultra’:
src/main.c:891:38: error: ‘ultrasonic’ undeclared (first use in this function)
int dist = (int)(adi_ultrasonic_get(ultrasonic));
^~~~~~~~~~
src/main.c:891:38: note: each undeclared identifier is reported only once for each function it appears in
src/main.c: In function ‘opcontrol’:
src/main.c:1482:39: error: ‘ultrasonic’ undeclared (first use in this function)
int dist = (int)(adi_ultrasonic_get(ultrasonic));
^~~~~~~~~~
make: *** [bin/main.c.o] Error 1
Capturing metadata for PROS Editor…
Error: Failed to build