71 int16_t
begin(uint8_t echoPin,
driver driver, uint8_t triggerPin,
bool autoTrigger =
true,
bool pullUp =
false)
76 uint8_t tx[] = { 200,
_pin,
_pinMode,(uint8_t)
driver, triggerPin, (uint8_t)pullUp,(uint8_t)autoTrigger, 0x55 };
77 return(
_sw.sendPacket(tx));
86 uint8_t tx[] = { 202,
_pin,
_pinMode,0x55,0x55,0x55,0x55, 0x55 };
88 if(
_sw.sendPacket(tx,rx) >= 0)
90 return (rx[5] + 256 * rx[6]);
106 uint8_t tx[] = { 201,
_pin,
_pinMode,1,0x55,0x55,0x55, 0x55 };
108 return _sw.sendPacket(tx);
113 int16_t
configureServoSweep(uint8_t servoPin,uint16_t memoryIndex,uint16_t servoPositions_,uint16_t servoIncrement,
bool reverse =
false, uint16_t servoMoveDelay = 100, uint16_t servoReturnDelay = 1000)
116 uint8_t tx[] = { 203,
_pin,
_pinMode, servoPin, (uint8_t)(memoryIndex & 0xFF), (uint8_t)(memoryIndex >>8),
117 (uint8_t)(servoPositions_ & 0xFF),(uint8_t)(servoPositions_ >>8)};
118 int16_t result =
_sw.sendPacket(tx);
119 if (result < 0) {
return result; }
122 uint8_t tx[] = {204,
_pin,
_pinMode, (uint8_t)(servoIncrement & 0xFF), (uint8_t)(servoIncrement >> 8),
123 0x55,0x55, (uint8_t)(reverse?1:0)};
124 int16_t result =
_sw.sendPacket(tx);
125 if (result < 0) {
return result; }
128 uint8_t tx[] = {205,
_pin,
_pinMode, (uint8_t)(servoMoveDelay & 0xFF), (uint8_t)(servoMoveDelay >> 8),
129 (uint8_t)(servoReturnDelay & 0xFF),(uint8_t)(servoReturnDelay >>8), 0x55};
130 int16_t result =
_sw.sendPacket(tx);
131 if (result < 0) {
return result; }
139 uint8_t tx[] = {206,
_pin,
_pinMode, (uint8_t)(enable ? 1 : 0),0x55,0x55,0x55, 0x55};
140 return _sw.sendPacket(tx);
147 return ((uint16_t)(b[0] + 256 * b[1]));
@ PIN_MODE_ULTRASONIC_DISTANCE
(27)
Class for a Serial Wombat chip. Each Serial Wombat chip on a project should have its own instance.
SerialWombatAbstractProcessedInput(SerialWombatChip &sw)
Constructor for the SerialWombatAbstractScaledOutput Class.
SerialWombatPin(SerialWombatChip &serialWombatChip)
Instantiates a Serial Wombat Pin.
int16_t configureServoSweep(uint8_t servoPin, uint16_t memoryIndex, uint16_t servoPositions_, uint16_t servoIncrement, bool reverse=false, uint16_t servoMoveDelay=100, uint16_t servoReturnDelay=1000)
Configure a Servo sweep of Ultrasonic Distance Sensor.
@ HC_SR04
Standard buffered mode. Colors are uploaded by the host.
uint16_t readServoSweepEntry(uint16_t servoSweepEntry)
uint8_t pin()
Facilitates Inheritance.
uint8_t swPinModeNumber()
Facilitates Inheritance.
SerialWombatUltrasonicDistanceSensor(SerialWombatChip &serialWombat)
Class constructor for SerialWombatPulseTimer.
int16_t enableServoSweep(bool enable=true)
uint16_t readPulseCount()
get the number of pulses that have been sent.
int16_t manualTrigger()
Manually trigger a distance reading.
int16_t begin(uint8_t echoPin, driver driver, uint8_t triggerPin, bool autoTrigger=true, bool pullUp=false)
Initialization routine for SerialWombatUltrasonicDistanceSensor.
int16_t readServoSweepEntries(uint16_t *entries, uint16_t count)
uint16_t servoMemoryIndex