#include #include /*************************************************** /MINDS-i Application. mymindsi.com / /Accelerometer Application / /This Accelerometer Application code is a basic example /of how to incorporate your Accelerometer in the Arduino /code. In this code your rover will drive straight until /it tips over in which case it will stop. / /***************************************************/ Servo drive, steer; float X,Y,Z; 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 } void loop() { Z = analogRead(A2); //store the value read off if( Z < .5 ) drive.write(90); //if less than half of normal G's is read vertically, stop else drive.write(100); //otherwise drive }