Manual
www.nexusrobot.com Robot Kits manual
68
setCarSpeedMMPSArc(speedMMPS,getRadiusMM(),uptime);
}
delayMS(duration,debug); //duration=5000 the car moves this action willl last 5000
milliseconds
setCarSlow2Stop(uptime); //uptime=500 set the car stop in 500 milliseconds
}
}
¾ R2WD_test
Here’s an example ,we use it to test a car with two wheels.after this ,you will More thorough
understanding of the library
Simple code:
#include <MotorWheel.h>
#include <R2WD.h>
#include <PID_Beta6.h>
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h> // Include the header files
/*
Wheel1 ||-----|| Wheel2
*/
irqISR(irq1,isr1); // Intterrupt function.on the basis of the pulse ,work for wheel1
MotorWheel wheel1(9,8,4,5,&irq1,REDUCTION_RATIO,int(144*PI));
//This will create a MotorWheel object called Wheel1
//Motor PWM:Pin9, DIR:Pin8, Encoder A:Pin4, B:Pin5
irqISR(irq2,isr2);