Quote:
Originally Posted by Shira
In the constructor:
Code:
m_ultra = new Ultrasonic(pingChannel, echoChannel);
m_ultra->SetAutomaticMode(true);
range = m_ultra->GetRangeInches();
But when I print out the range I get only zeros.
|
Are you ever setting
range anywhere else? The assignment in the constructor most likely occurs before any echoes have been received, so it won't be a valid value. I believe calling
m_ultra->GetRangeInches() later should give you the current range.