![]() |
RoboidControl for Arduino
|
An HC-SR04 ultrasonic distance sensor. More...
#include <UltrasonicSensor.h>
Public Member Functions | |
| UltrasonicSensor () | |
| Setup an ultrasonic sensor. | |
| UltrasonicSensor (uint8_t pinTrigger, uint8_t pinEcho) | |
| Setup the ultrasonic sensor. | |
| float | GetDistance () |
| perform an ultrasonic 'ping' to determine the distance to the nearest object | |
| bool | IsOn () |
| Indicate that an object is nearby. | |
| bool | IsMotor () |
| Check if the Thing is a Motor. | |
| bool | IsSensor () |
| Check if the Thing is a Sensor. | |
Public Attributes | |
| uint8_t | pinTrigger |
| The pin number of the trigger signal. | |
| uint8_t | pinEcho |
| The pin number of the echo signal. | |
| float | triggerDistance = 1 |
| The distance at which ObjectNearby triggers. | |
| unsigned int | type |
| The type of Thing. | |
Static Public Attributes | |
| static const unsigned int | SwitchType = SensorType | (unsigned int)Type::Switch |
| static const unsigned int | DistanceSensorType |
| static const unsigned int | ControlledMotorType |
| static const unsigned int | UncontrolledMotorType |
Protected Types | |
| enum class | Type { Undetermined , Switch , DistanceSensor , ControlledMotor , UncontrolledMotor } |
| Basic Thing types. More... | |
Protected Attributes | |
| float | distance = 0 |
| Distance to the closest object. | |
Static Protected Attributes | |
| static const unsigned int | MotorType = 0x8000 |
| Bitmask for Motor type. | |
| static const unsigned int | SensorType = 0x4000 |
| Bitmap for Sensor type. | |
An HC-SR04 ultrasonic distance sensor.
|
strongprotectedinherited |
Basic Thing types.
| Enumerator | |
|---|---|
| Undetermined | |
| Switch | |
| DistanceSensor | |
| ControlledMotor | |
| UncontrolledMotor | |
| Passer::RoboidControl::UltrasonicSensor::UltrasonicSensor | ( | ) |
Setup an ultrasonic sensor.
| UltrasonicSensor::UltrasonicSensor | ( | uint8_t | pinTrigger, |
| uint8_t | pinEcho | ||
| ) |
Setup the ultrasonic sensor.
| pinTrigger | the pin number of the trigger signal |
| pinEcho | the pin number of the echo signal |
|
virtual |
perform an ultrasonic 'ping' to determine the distance to the nearest object
Reimplemented from Passer::RoboidControl::DistanceSensor.
|
inherited |
Indicate that an object is nearby.
|
inherited |
|
inherited |
| uint8_t Passer::RoboidControl::UltrasonicSensor::pinTrigger |
The pin number of the trigger signal.
| uint8_t Passer::RoboidControl::UltrasonicSensor::pinEcho |
The pin number of the echo signal.
|
inherited |
The distance at which ObjectNearby triggers.
|
protectedinherited |
Distance to the closest object.
|
inherited |
The type of Thing.
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticprotectedinherited |
Bitmask for Motor type.
|
staticprotectedinherited |
Bitmap for Sensor type.