Arduino {code}racer API
... better know the details.

Functions

void CodeRacer::usonic_set_stop_distance_cm (unsigned long stop_distance_cm)
 Sets the stop distance in cm. More...
 
void CodeRacer::usonic_set_stop_distance_us (unsigned long stop_distance_us)
 Sets the stop distance in cm. More...
 
unsigned long CodeRacer::usonic_distance_us ()
 Returns the last measured distance in microseconds. More...
 
unsigned long CodeRacer::usonic_distance_cm ()
 Returns the last measured distance in cm. More...
 

Detailed Description

Function Documentation

◆ usonic_set_stop_distance_cm()

void CodeRacer::usonic_set_stop_distance_cm ( unsigned long  stop_distance_cm)

Sets the stop distance in cm.

If start_stop_at_min_distance() is used and distance measured with one of the measurement methods - the racer will be stopped immediately. All except the singe shot methods of the ultra sonic measurements methods supports that. Internally the stop distance will be set as both - in cm and in microseconds.

Parameters
stop_distance_cmDistance in cm the racer will be stopped if that features was enabled by start_stop_at_min_distance() before.
Returns
nothing

Definition at line 825 of file CodeRacer.cpp.

826 {
827  _usonic_stop_distance_us = stop_distance_cm * 58.14;
828 }

◆ usonic_set_stop_distance_us()

void CodeRacer::usonic_set_stop_distance_us ( unsigned long  stop_distance_us)

Sets the stop distance in cm.

If start_stop_at_min_distance() is used and distance measured with one of the measurement methods - the racer will be stopped immediately. All except the singe shot methods of the ultra sonic measurements methods supports that. Internally the stop distance will be set as both - in cm and in microseconds.

Parameters
stop_distance_usDistance in cm the racer will be stopped if that features was enabled by start_stop_at_min_distance() before.
Returns
nothing

Definition at line 837 of file CodeRacer.cpp.

838 {
839  _usonic_stop_distance_us = stop_distance_us;
840 }

◆ usonic_distance_us()

unsigned long CodeRacer::usonic_distance_us ( )

Returns the last measured distance in microseconds.

Returns
Distance in microseconds

Definition at line 845 of file CodeRacer.cpp.

845  {
846  return(_usonic_distance_us);
847 }

◆ usonic_distance_cm()

unsigned long CodeRacer::usonic_distance_cm ( )

Returns the last measured distance in cm.

Returns
Distance in cm

Definition at line 852 of file CodeRacer.cpp.

852  {
853  return(_usonic_distance_cm);
854 }