![]() |
Serial Wombat Arduino Library
|
A Class which uses one or two Serial Wombat 18AB pins to measure distance using an Ultrasonic distance sensor.
More...
#include <SerialWombatUltrasonicDistanceSensor.h>
Public Types | |
enum | driver { HC_SR04 = 0 } |
![]() | |
enum | Frequency { FREQ_1Hz = 0, FREQ_2Hz = 1, FREQ_4Hz = 2, FREQ_8Hz = 3, FREQ_16Hz = 4, FREQ_32Hz = 5, FREQ_64Hz = 6, FREQ_128Hz = 7, FREQ_256Hz = 8, FREQ_512Hz = 9, FREQ_1024Hz = 10 } |
enum | OutputValue { RAW = 0, AVERAGE = 1, FIRST_ORDER_FILTERED = 2 } |
enum | Transform { NONE = 0, SCALE_RANGE = 1, LINEAR_MXB = 2 } |
Public Member Functions | |
SerialWombatUltrasonicDistanceSensor (SerialWombatChip &serialWombat) | |
Class constructor for SerialWombatPulseTimer. More... | |
int16_t | begin (uint8_t echoPin, driver driver, uint8_t triggerPin, bool autoTrigger=true, bool pullUp=false) |
Initialization routine for SerialWombatUltrasonicDistanceSensor. More... | |
uint16_t | readPulseCount () |
int16_t | manualTrigger () |
uint8_t | pin () |
uint8_t | swPinModeNumber () |
![]() | |
SerialWombatPin (SerialWombatChip &serialWombatChip) | |
Instantiates a Serial Wombat Pin. More... | |
SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin) | |
Instantiates a Serial Wombat Pin. More... | |
uint16_t | readPublicData () |
Read the 16 Bit public data associated with this pin. More... | |
void | pinMode (uint8_t mode) |
Set pin to INPUT or OUTPUT. More... | |
void | pinMode (uint8_t mode, bool pullDown, bool openDrain) |
Set pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings. More... | |
void | digitalWrite (uint8_t val) |
Set output pin High or Low. More... | |
int | digitalRead () |
Reads the state of the Pin. More... | |
uint16_t | writePublicData (uint16_t value) |
Write a 16 bit value to this pin. More... | |
uint8_t | pin () |
Returns the current SW pin number. Used primarily for virtual calls by derived classes. More... | |
uint8_t | swPinModeNumber () |
Returns the Mode number. Used primarily by derived classes to populate packet data. More... | |
![]() | |
SerialWombatAbstractProcessedInput (SerialWombatChip &sw) | |
Constructor for the SerialWombatAbstractScaledOutput Class. More... | |
int16_t | writeInverted (bool inverted) |
int16_t | writeFirstOrderFilteringConstant (uint16_t constant) |
int16_t | writeAveragingNumberOfSamples (uint16_t numberOfSamples) |
int16_t | writeExcludeBelowAbove (uint16_t low, uint16_t high) |
int16_t | configureQueue (SerialWombatQueue *queue, Frequency frequency, bool queueHighByte=true, bool queueLowByte=true) |
int16_t | configureOutputValue (OutputValue outputValue) |
int16_t | configureTransformScaleRange (uint16_t min, uint16_t max) |
int16_t | configureTransformLinearMXB (int32_t m, int32_t b) |
int16_t | writeProcessedInputEnable (bool enabled) |
uint16_t | readMinimum (bool reset=false) |
uint16_t | readMaximum (bool reset=false) |
uint16_t | readAverage () |
uint16_t | readFiltered () |
Additional Inherited Members | |
![]() | |
uint8_t | _pin = 255 |
SerialWombatChip & | _sw |
uint8_t | _pinMode = 0 |
A Class which uses one or two Serial Wombat 18AB pins to measure distance using an Ultrasonic distance sensor.
A video Tutorial on this pin mode is available:
//TODO
TODO https://youtu.be/
SerialWombatUltrasonicDistanceSensor::SerialWombatUltrasonicDistanceSensor | ( | SerialWombatChip & | serialWombat | ) |
Class constructor for SerialWombatPulseTimer.
serialWombat | The Serial Wombat chip on which the SerialWombatPulseTimer pinmode will be run |
int16_t SerialWombatUltrasonicDistanceSensor::begin | ( | uint8_t | echoPin, |
driver | driver, | ||
uint8_t | triggerPin, | ||
bool | autoTrigger = true , |
||
bool | pullUp = false |
||
) |
Initialization routine for SerialWombatUltrasonicDistanceSensor.
echoPin | Pin used to time input pulses. For 5V sensors, 5V tolerant pins 9,10,11,12, 14 and 15 are good choices |
driver | Chip used for distance measurement. Currently only HC_SR04 is supported. |
triggerPin | Pin used for triggering the sensor. If same as echo pin (e.g. 3 pin sensors) set equal to echoPin |
int16_t SerialWombatUltrasonicDistanceSensor::manualTrigger | ( | ) |
|
inlinevirtual |
Implements SerialWombatAbstractProcessedInput.
uint16_t SerialWombatUltrasonicDistanceSensor::readPulseCount | ( | ) |
|
inlinevirtual |
Implements SerialWombatAbstractProcessedInput.