|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools |
Rating:
|
Display Modes |
|
#2
|
|||
|
|||
|
Re: Freebie LV-MaxSonar-EZ1 Code (Sonar Range Finder)
First, you cannot put code like that in a header file. Header files are meant to declare variables and functions, not use them. You have to put all of the initialization and actual code in a .cpp file. Second, you can just set it up like this:
Code:
void GetDistance()
{
AnalogChannel *range;
range = new AnalogChannel(1,1);
float volt;
volt = range->GetVoltage();
float inches;
inches = volt * 100;
return inches;
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|