Manual

www.nexusrobot.com Robot Kits manual
86
¾ Omni3WD_test
Here’s an example ,we use it to test a car with three wheels.after this ,you will More thorough
understanding of the library
Simple code:
#include <MotorWheel.h>
#include <Omni3WD.h>
#include <Omni4WD.h>
#include <PID_Beta6.h>
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h> // Include the header files
/*
Wheel3 // \\ Wheel2
==
Wheel1
*/
irqISR(irq1,isr1); // Intterrupt function.on the basis of the pulse ,work for wheel1
MotorWheel wheel1(9,8,6,7,&irq1); //This will create a MotorWheel object called Wheel1
//Motor PWM:Pin9, DIR:Pin8, Encoder A:Pin6, B:Pin7
irqISR(irq2,isr2);
MotorWheel wheel2(10,11,12,13,&irq2);
irqISR(irq3,isr3);
MotorWheel wheel3(3,2,4,5,&irq3);
//MotorWheel wheel3(5,4,2,3,&irq3);
// why not this?? Because the pin 5,pin 6 control by timer 0
Omni3WD Omni(&wheel1,&wheel2,&wheel3);
// This will create a Omni3WD object called Omni3WD.
//You can then use any of its methods; for instance,