#include #include /*************************************************** / MINDS-i Application. mymindsi.com / /QTI Application / /This QTI Application code is a basic example /of how to incorporate your QTI sensor in the /Arduino code. In this code your rover will /follow a black line. / /***************************************************/ Servo steer, drive; int threshold = 300; 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 drive.write(105); } void loop(){ if( QTI(A1) < threshold){ //if the center sensor is off if( QTI(A0) > threshold) { //and the left is on steer.write(45); //turn left } else if(QTI(A2) > threshold) { //if not left, right? steer.write(135); //turn right } } else{ steer.write(90); //drive straight } }