www.nexusrobot.com Robot Kits manual
118
rotateLeft, backOff, turnLeft, allStop}; // used the method of demotion
unsigned long currMillis=0;
void demoWithSensors(unsigned int speedMMPS,unsigned int distance) {
unsigned char sonarcurrent = 0;
if(millis()-currMillis>SONAR::du 20) { // every 80 ms to call sonarUpdate once
currMillis=millis();
sonarcurrent = sonarsUpdate();
}
if(sonarcurrent == 4){
unsigned char bitmap = (distBuf[0] < distance); //right Four of every byte
bitmap |= (distBuf[1] < distance) << 1; // back
bitmap |= (distBuf[2] < distance) << 2; // left
bitmap |= (distBuf[3] < distance) << 3; // front
(*motion[bitmap])(speedMMPS);
}
Omni.PIDRegulate(); //PID regulate
}
void setup() {
delay(2000);
TCCR1B=TCCR1B&0xf8|0x01; // Pin9,Pin10 PWM 31250Hz
TCCR2B=TCCR2B&0xf8|0x01; // Pin3,Pin11 PWM 31250Hz
SONAR::init(13);
//Omni.switchMotors();
Omni.PIDEnable(2.0,1.0,0,10); //PID enable
}
void loop() {
//Omni.demoActions(250,5000,500,false);
demoWithSensors(100,30); //call the demo speed=300, distance=30.
}
¾
Servo Motor
Summary of Contents for Nexus Robot
Page 74: ...www nexusrobot com Robot Kits manual 70 Sample Wiring Diagram for RB004 2WD V2 0...
Page 92: ...www nexusrobot com Robot Kits manual 88 Diagram for Omni3WD_V1 0...
Page 96: ...www nexusrobot com Robot Kits manual 92 Diagram_Omni3WD_V3 3...
Page 118: ...www nexusrobot com Robot Kits manual 114 Sample Wiring Diagram for RB011 Mecanum 4WD V4 1...