Nexus Automation Nexus Robot User Manual page 76

Kits
Table of Contents

Advertisement

www.nexusrobot.com
unsigned char irL0_pin=0;
unsigned char irC0_pin=1;
unsigned char irR0_pin=2;
int ir_distance(unsigned char ir) {
int val=analogRead(ir);
return (6762/(val-9))-4;
}
/*********************************************/
// bumper
unsigned char bumperL_pin=12;
unsigned char bumperC_pin=3;
unsigned char bumperR_pin=2;
/ *********************************************/
irqISR(irq1,isr1);
MotorWheel wheel1(9,8,4,5,&irq1,REDUCTION_RATIO,int(144*PI));
irqISR(irq2,isr2);
MotorWheel wheel2(10,11,6,7,&irq2,REDUCTION_RATIO,int(144*PI));
R2WD _2WD(&wheel1,&wheel2,WHEELSPAN);
unsigned int speedMMPS=80;
void setup() {
//TCCR0B=TCCR0B&0xf8|0x01;
TCCR1B=TCCR1B&0xf8|0x01;
//TCCR2B=TCCR2B&0xf8|0x01;
SONAR::init(13);
_2WD.PIDEnable(0.26,0.02,0,10);
}
// Set Analog pin 0 as the left Infrared Sensor signal pin
// Set Analog pin 2 as the right Infrared Sensor signal pin
// Read the data from the Infrared Sensors
// Change the data
// Set pin 12 as the left Bumper's Sensor signal pin
// Set pin 3 as the front Bumper's Sensor signal pin
// Set pin 2 as the right Bumper's Sensor signal pin
// Intterrupt function.on the basis of the pulse, work for wheel1
//This will create a MotorWheel object called Wheel1
//Motor PWM:Pin9, DIR:Pin8, Encoder A:Pin4, B:Pin5
// warning!! it will change millis()
// Pin9,Pin10 PWM 31250Hz
// Pin3,Pin11 PWM 31250Hz
// Pin13 as RW Control
// Enable PID
Robot Kits manual
72

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Nexus Robot and is the answer not in the manual?

Questions and answers

Table of Contents