#include #include /*************************************************** / MINDS-i Application. mymindsi.com / /Ping Sensor Application / /This Ping Application code is a basic example /of how to incorporate your PING sensor in the /Arduino code. In this code your rover will /drive until it sees an object with the PING /sensor and then it will stop. / /***************************************************/ Servo drive, steer; void setup() { drive.attach(4); //set a pin for the ESC/steering servo to use steer.attach(5); drive.write(90); //set the output for the ESC/servo steer.write(90); delay(1000); //delay 1 second for arming steer.write(180); } void loop() { if( getPing(10) < 500 ) drive.write(90); //if there is no room in front, stop else drive.write(100); //otherwise go forward }