|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#12
|
|||
|
|||
|
Re: Programming ultrasonic rangefinders
You would instance it much like you would a jaguar, or any other device.
Code:
#include "AnalogRangeFinder.h"
#define ANALOG_CHANNEL_FOR_SONAR 1
class Robot2012 : public IterativeRobot
{
AnalogRangeFinder sonar;
public:
Robot2012(void):sonar(ANALOG_CHANNEL_FOR_SONAR)
{
}
void AutonomousPeriodic(void)
{
float distance = sonar.GetRangeInches();
}
}
START_ROBOT_CLASS(Robot2012);
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|