#include <Servo.h>
//Declarations and vraibales needed throughout the sketch
Servo Wheel;
int servoPin1 = 10;
void setup() {
//This code is executed once at the start of the sketch
// You can print out things from your code to show the order of things happening
Serial.begin(115200);
Wheel.attach(servoPin1);
Wheel.write(0);
delay(2000);
}
void loop() {
//The code in this function is executed repeatedly once set up has finished
Serial.println("=== Repeat ====");
//Call the function straight()
straight();
delay(1000);
}
void straight() {
//Definition fo this function
// A function for wheel motion
int r = 0;
for (r = 0; r <= 30; r++) {
Serial.println(r);
Wheel.write(r);
delay(10);
}
}