//Initialize pins //E1 and M1 control the right wheel //E2 and M2 control the left wheel int E1=5; //E1 is the pin number of the speed control pin int M1=4; //M1 is the pin number of the pin that controls direction int E2=6; //E2 is the pin number of the speed control pin int M2=7; //M2 is the pin number of the pin that controls direction //Use PWM setting (this setting allows you to change the speed of //the motors) void setup () { //Set each pin to output pinMode(E1, OUTPUT); pinMode(M1, OUTPUT); pinMode(E2, OUTPUT); pinMode(M2, OUTPUT); } void loop () { //Make the robot move forward, backwards, turn, and spin. digitalWrite(E1, HIGH); digitalWrite(M1, LOW); digitalWrite(E2, HIGH); digitalWrite(M2, LOW); //Hint: try changing each pin individually to see how each //pin controls the direction/speed. //Note: Obstacle robots and maze robots may potentially //have different forward code. If this is the case, //the maze robot will have the direction switched for the //forward code above. } //Note: If you use analog write with the E1 or E2 pin, //you can input a value between 0 and 255 to control speed //Ex. analogWrite(E1, 100);