#include <arpirobot/arduino/sensor/Ultrasonic4Pin.hpp>
|
| Ultrasonic4Pin (int triggerPin, int echoPin, bool createDevice=true, int deviceId=-1) |
|
| Ultrasonic4Pin (int triggerPin, std::string echoPin, bool createDevice=true, int deviceId=-1) |
|
| Ultrasonic4Pin (std::string triggerPin, int echoPin, bool createDevice=true, int deviceId=-1) |
|
| Ultrasonic4Pin (std::string triggerPin, std::string echoPin, bool createDevice=true, int deviceId=-1) |
|
int | getDistance () |
|
| ArduinoDevice (bool createDevice, int deviceId) |
|
virtual std::string | getDeviceName () |
|
|
void | applyDefaultState () override |
|
std::vector< uint8_t > | getCreateData () override |
|
void | handleData (const std::vector< uint8_t > &data) override |
|
void | setArduino (BaseArduinoInterface *arduino) |
|
void | setDeviceId (int deviceId) |
|
bool | sendData (const std::vector< uint8_t > &data) |
|
bool | sendData (const std::string &data) |
|
|
static std::vector< uint8_t > | stringToData (const std::string &str) |
|
bool | createDevice |
|
int | deviceId |
|
std::string | deviceName |
|
BaseArduinoInterface * | arduino = nullptr |
|
Device for 4-pin ultrasonic sensor.
◆ Ultrasonic4Pin() [1/4]
arpirobot::Ultrasonic4Pin::Ultrasonic4Pin |
( |
int |
triggerPin, |
|
|
int |
echoPin, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
triggerPin | Digital pin number for the trigger pin |
echoPin | Digital pin number for the echo pin |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ Ultrasonic4Pin() [2/4]
arpirobot::Ultrasonic4Pin::Ultrasonic4Pin |
( |
int |
triggerPin, |
|
|
std::string |
echoPin, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
triggerPin | Digital pin number for the trigger pin |
echoPin | Pin number for the echo pin (prefix with letter A for analog pin) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ Ultrasonic4Pin() [3/4]
arpirobot::Ultrasonic4Pin::Ultrasonic4Pin |
( |
std::string |
triggerPin, |
|
|
int |
echoPin, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
triggerPin | Pin number for the trigger pin (prefix with letter A for analog pin) |
echoPin | Digital pin number for the echo pin |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ Ultrasonic4Pin() [4/4]
arpirobot::Ultrasonic4Pin::Ultrasonic4Pin |
( |
std::string |
triggerPin, |
|
|
std::string |
echoPin, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
triggerPin | Pin number for the trigger pin (prefix with letter A for analog pin) |
echoPin | Pin number for the echo pin (prefix with letter A for analog pin) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ getDistance()
int arpirobot::Ultrasonic4Pin::getDistance |
( |
| ) |
|
Get the last distance read by the ultrasonic sensor
- Returns
- The distance in cm
The documentation for this class was generated from the following file: