ultrasonic sensor vs servo programming issue

Hi,

I'm tinkering with a servo and an ultrasonic sensor on my uno but while coding stumbled upon this error which I cant seem to figure out. I only get other errors when I try to fix it.

Anybody who can help me out here?

hcsr04_vs_servo.ino (3.29 KB)

unsigned long duration;

But you haven't made a reading, yet.

Post code, not pictures.

This is nothing to do with the servo.

You have a multitude of issues with the code. You have functions defined within your loop() function, misplaced semicolons, and referencing variables outside of their scope. You should review some fundamental C/C++ concepts.

I would try to fix your code but then I wouldn't be sure if it would operate as intended.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.