Manual
www.nexusrobot.com Robot Kits manual
120
analogWrite(MOTOR3_E,53); //forward run motor3
}
void Right(){
analogWrite(MOTOR1_E,66); //forward run motor1
analogWrite(MOTOR2_E,40); //Reverse run motor2
analogWrite(MOTOR3_E,40); //Reverse run motor3
}
//************************************************//
void RotateRight(){
analogWrite(MOTOR1_E,66); //forward run motor1
analogWrite(MOTOR2_E,62); //forward run motor2
analogWrite(MOTOR3_E,64); //forward run motor3
}
//*************************************************//
void RotateLeft(){
analogWrite(MOTOR1_E,36); // reverse run motor 1
analogWrite(MOTOR2_E,32); // reverse run motor 2
analogWrite(MOTOR3_E,34); // reverse run motor 3
}
//**************************************************//
void allStop(){
analogWrite(MOTOR1_E, 48); //stop run motor1
analogWrite(MOTOR2_E, 44); //stop run motor2
analogWrite(MOTOR3_E, 46); //stop run motor3
}
//*************************************************//
void (*motion[7])()={ goAhead,getBack,Left,Right,RotateLeft,RotateRight,allStop};
void demotion(){
for(int i=0;i<7;i++){ // The demotion have 8 actions
(*motion[i])(); // call the action
delay(3000); // Each action last 3000 milliseconds
}
}
//*************************************************//
void setup() {
TCCR1B=TCCR1B&0xf8|0x04; //PIN 9 and PIN 10 cotroled by Timer1 122HZ
TCCR2B=TCCR2B&0xf8|0x06; //PIN 11 and PIN 3 cotroled by Timer2 122HZ