Created
May 25, 2017 16:05
-
-
Save kvablack/cea3f95046acae10cc2ee15abafb16ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
#define distance 9.42038797 //in meters, determines time | |
#define MotorPort 9 | |
#define FORWARD 101 //speed | |
#define COAST 90 | |
#define extraTime 1 //in seconds so the car drives longer than necessary | |
//#define driveTime 4000 | |
Servo motor; | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin (9600); | |
motor.attach(9); | |
motor.write(FORWARD); | |
delay((.2753 * distance + .3308 + extraTime)*1000); | |
motor.write(COAST); | |
motor.detach(); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment