ArPiRobot-CoreLib C++
C++ library for ArPiRobot robots
Public Member Functions | Protected Member Functions | List of all members
arpirobot::IRReflectorModule Class Reference

#include <arpirobot/arduino/sensor/IRReflectorModule.hpp>

Inheritance diagram for arpirobot::IRReflectorModule:
arpirobot::ArduinoDevice

Public Member Functions

 IRReflectorModule (int digitalPin, bool createDevice=true, int deviceId=-1)
 
 IRReflectorModule (std::string digitalPin, bool createDevice=true, int deviceId=-1)
 
 IRReflectorModule (int digitalPin, std::string analogPin, bool createDevice=true, int deviceId=-1)
 
 IRReflectorModule (std::string digitalPin, std::string analogPin, bool createDevice=true, int deviceId=-1)
 
bool getDigitalValue ()
 
int getAnalogValue ()
 
- Public Member Functions inherited from arpirobot::ArduinoDevice
 ArduinoDevice (bool createDevice, int deviceId)
 
virtual std::string getDeviceName ()
 

Protected Member Functions

void applyDefaultState () override
 
std::vector< uint8_t > getCreateData () override
 
void handleData (const std::vector< uint8_t > &data) override
 
- Protected Member Functions inherited from arpirobot::ArduinoDevice
void setArduino (BaseArduinoInterface *arduino)
 
void setDeviceId (int deviceId)
 
bool sendData (const std::vector< uint8_t > &data)
 
bool sendData (const std::string &data)
 

Additional Inherited Members

- Static Protected Member Functions inherited from arpirobot::ArduinoDevice
static std::vector< uint8_t > stringToData (const std::string &str)
 
- Protected Attributes inherited from arpirobot::ArduinoDevice
bool createDevice
 
int deviceId
 
std::string deviceName
 
BaseArduinoInterfacearduino = nullptr
 

Detailed Description

Infrared reflection detector module

Constructor & Destructor Documentation

◆ IRReflectorModule() [1/4]

arpirobot::IRReflectorModule::IRReflectorModule ( int  digitalPin,
bool  createDevice = true,
int  deviceId = -1 
)
Parameters
digitalPinThe digital output pin for this sensor
createDeviceLeave this true unless the device is hard-coded in arduino firmware
deviceIdSet this to the hard-coded deviceId if createDevice is false

◆ IRReflectorModule() [2/4]

arpirobot::IRReflectorModule::IRReflectorModule ( std::string  digitalPin,
bool  createDevice = true,
int  deviceId = -1 
)
Parameters
digitalPinThe digital output pin for this sensor (prefix with letter A for analog pin)
createDeviceLeave this true unless the device is hard-coded in arduino firmware
deviceIdSet this to the hard-coded deviceId if createDevice is false

◆ IRReflectorModule() [3/4]

arpirobot::IRReflectorModule::IRReflectorModule ( int  digitalPin,
std::string  analogPin,
bool  createDevice = true,
int  deviceId = -1 
)
Parameters
digitalPinThe digital output pin for this sensor
analogPinThe analog output pin for this sensor (can be prefixed with letter A, but not required)
createDeviceLeave this true unless the device is hard-coded in arduino firmware
deviceIdSet this to the hard-coded deviceId if createDevice is false

◆ IRReflectorModule() [4/4]

arpirobot::IRReflectorModule::IRReflectorModule ( std::string  digitalPin,
std::string  analogPin,
bool  createDevice = true,
int  deviceId = -1 
)
Parameters
digitalPinThe digital output pin for this sensor (prefix with letter A for analog pin)
analogPinThe analog output pin for this sensor (can be prefixed with letter A, but not required)
createDeviceLeave this true unless the device is hard-coded in arduino firmware
deviceIdSet this to the hard-coded deviceId if createDevice is false

Member Function Documentation

◆ getAnalogValue()

int arpirobot::IRReflectorModule::getAnalogValue ( )

Get the analog reflection signal strength (if this device was setup to use an analog input)

Returns
The read analog value (will be zero if not configured for analog data)

◆ getDigitalValue()

bool arpirobot::IRReflectorModule::getDigitalValue ( )

Get the digital value read from the sensor

Returns
true or false. One cooresponds to reflection detected. The other is no reflection detected.

The documentation for this class was generated from the following file: