Nexus Automation Nexus Robot User Manual page 98

Kits
Table of Contents

Advertisement

www.nexusrobot.com
SONAR sonar11(0x11),sonar12(0x12),sonar13(0x13),sonar14(0x14),sonar15(0x15),sonar16(0x16);
unsigned short distBuf[6];
void sonarsUpdate() {
static unsigned char sonarCurr=1;
if(sonarCurr==3) sonarCurr=1;
else ++sonarCurr;
if(sonarCurr==1) {
distBuf[1]=sonar12.getDist();
distBuf[4]=sonar15.getDist();
sonar11.trigger();
sonar14.trigger();
} else if(sonarCurr==2) {
distBuf[2]=sonar13.getDist();
distBuf[5]=sonar16.getDist();
sonar12.trigger();
sonar15.trigger();
} else {
distBuf[0]=sonar11.getDist();
distBuf[3]=sonar14.getDist();
sonar13.trigger();
sonar16.trigger();
}
}
/*********************************************/
/*********************************************/
unsigned char IRpin[]={16,17,18};
bool IRs[3]={false,false,false};
void initIRs() {
pinMode(IRpin[0],INPUT);
pinMode(IRpin[1],INPUT);
pinMode(IRpin[2],INPUT);
}
// Software initialization
//SONAR is be defined in <SONAR.h> as a class
// Used to save the data of the 6 sonars return;
// A variable save a data used to flag the current of sonar
// The conditions is ture?
// Get the value of distance from sonar12
// Trigger sonar11
// Pin16, Pin17, Pin18
// Initial the Pin mode
Robot Kits manual
94

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