Problem with J Blum

Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “Arduino Uno”

C:\Users\Graham\Documents\Arduino\Jeremy BlumTutorials\Fresh start Jan 2021\Chap 4 Using Transistors driviving motors\Chap_4.14_Servo_Sweeping_Distance_Sensor\Chap_4.14_Servo_Sweeping_Distance_Sensor.ino: In function ‘int readDistance(int)’:

Chap_4.14_Servo_Sweeping_Distance_Sensor:60:3: error: expected primary-expression before ‘return’

return dist; // Return scaled distance

^~~~~~

C:\Users\Graham\Documents\Arduino\Jeremy BlumTutorials\Fresh start Jan 2021\Chap 4 Using Transistors driviving motors\Chap_4.14_Servo_Sweeping_Distance_Sensor\Chap_4.14_Servo_Sweeping_Distance_Sensor.ino: At global scope:

Chap_4.14_Servo_Sweeping_Distance_Sensor:63:1: error: expected declaration before ‘}’ token

}

^

Multiple libraries were found for “Servo.h”

Used: C:\Users\Graham\Documents\Arduino\libraries\Servo

Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\Servo

exit status 1

expected primary-expression before ‘return’

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Post YOUR code that caused those errors using code tags.

i do not have time to try to track down that tutorial.

Thanks for your reply Shannon. I haven’t yet got the hang of posting on the forum. The problem has been overcome. I used Jeremy Blum’s original code. Still cannot see where my mistake is. Project works. IR distance sensor works although the servo is very sticky. Gets stuck. Looking a ways to overcome this as the servo is working fine with simpler code projects. Thanks again.
Ostieman

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