Issues with obstacle avoidance code

Hello readysetterrible

These first errors could mean that the NewPing library has not been correctly installed in the Arduino IDE. Or the Arduino IDE was not stopped and restarted after installing them.

yoghurt_tub_bot_basic_obstable_avoidance_code:11: error: 'NewPing' does not name a type
yoghurt_tub_bot_basic_obstable_avoidance_code.ino: In function 'void scan()':
yoghurt_tub_bot_basic_obstable_avoidance_code:60: error: 'sonar' was not declared in this scope
yoghurt_tub_bot_basic_obstable_avoidance_code:61: error: 'US_ROUNDTRIP_CM' was not declared in this scope

These later errors look like a second program is being compiled. Do you have two tabs open in the Arduino IDE?

NewPing15Sensors.pde: At global scope:
NewPing15Sensors:22: error: 'NewPing' does not name a type
NewPing15Sensors.pde: In function 'void setup()':
NewPing15Sensors:40: error: redefinition of 'void setup()'
yoghurt_tub_bot_basic_obstable_avoidance_code:20: error: 'void setup()' previously defined here
NewPing15Sensors.pde: In function 'void loop()':
NewPing15Sensors:47: error: redefinition of 'void loop()'

Regards

Ray