![]() |
MOREbot_Library
1.3.2
Library to control the MOREbot base robot
|
#include <MOREbot.h>
Public Member Functions | |
ultrasonic (int trig, int echo) | |
float | readDistance () |
Ultrasonic class. Handles communicating with the ultrasonic module to determine distance to the nearest object.
ultrasonic::ultrasonic | ( | int | trig, |
int | echo | ||
) |
Ultrasonic constructor. Saves the pins to communicate with the ultrasonic module.
trig | an integer. The pin on the arduino that the ultrasonic's trig pin is connected to. |
echo | an integer. The pin on the arduino that the ultrasonic's echo pin is connected to. |
float ultrasonic::readDistance | ( | ) |
Function to get distance from the Ultrasonic. Activates the ultrasonic, reads the echo time, and processes that time into a distance in centimeters.