Manual

www.nexusrobot.com Robot Kits manual
95
void checkIRs() { // Read the Anti-drop Sonars
for(int i=0;i<3;++i) {
IRs[i]=digitalRead(IRpin[i]); // Save datas
Serial.print(IRs[i]); // display the datas
}
Serial.println("");
}
/********************************************/
/*******************************************/
// Wheels
irqISR(irq1,isr1);
MotorWheel wheel1(9,8,6,7,&irq1); // Pin9:PWM, Pin8:DIR, Pin6:PhaseA, Pin7:PhaseB
irqISR(irq2,isr2);
MotorWheel wheel2(10,11,14,15,&irq2); // Pin10:PWM, Pin11:DIR, Pin14:PhaseA, Pin15:PhaseB
irqISR(irq3,isr3);
MotorWheel wheel3(3,2,4,5,&irq3); // Pin3:PWM, Pin2:DIR, Pin4:PhaseA, Pin5:PhaseB
//MotorWheel wheel3(5,4,2,3,&irq3);
Omni3WD Omni(&wheel1,&wheel2,&wheel3);
// This will create a Omni3WD object called Omni. then You
// can use any of its methods; for instance, to
// control a Omni3WD attached to pins, you could write
/******************************************/
/******************************************/
// demo
unsigned long currMillis=0;
void demoWithSensors(unsigned int speedMMPS,unsigned int distance,unsigned int ms) {
if(millis()-currMillis>SONAR::duration) { // Every 60 ms call the SonarsUpdate() once time
currMillis=millis();
sonarsUpdate();
}
checkIRs(); // check the Anti-drop sonars