Manual
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::duration + 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 










