28 uint16_t maxReading = 0;
29 uint16_t currentReading = 0;
33 for(
const auto pt : allIRPTs){
35 if (currentReading > maxReading){
36 maxReading = currentReading;
42 for(
const auto pt : allDLPTs){
44 if (currentReading > maxReading){
45 maxReading = currentReading;
56 TickType_t xLastWakeTime = xTaskGetTickCount();
57 TickType_t frequency = timeBetween / portTICK_PERIOD_MS;
58 uint64_t cumulatedResult = 0;
59 for(
int i = 0; i < measurments; i++){
61 xTaskDelayUntil(&xLastWakeTime,frequency);
63 return cumulatedResult/measurments;
Class for Reading the values of the different Phototransistors, both IR, and DaylightSensors are supp...
static const uint8_t IR_PT_ENABLE
static void beginDaylight(void)
static void beginInfrared(void)
static const uint8_t DL_PT_FRONT_ADC
static uint16_t readIRPT(photoTransistors sensor)
static uint16_t getValue(photoTransistors sensor)
reads the Value of the specified sensor
static const uint8_t DL_PT_ENABLE
static const uint8_t DL_PT_BOTTOM_ADC
static uint16_t readDLPT(photoTransistors sensor)
static uint32_t getAverageValue(photoTransistors sensor, uint32_t measurments, uint32_t timeBetween)
Get the Average of multiple measurments of a single PT.
static const uint8_t IR_PT_BACK_ADC
static photoTransistors getBrightest(ptType type)
can be used to determine which sensor is exposed to the greatest amount of light Can distingish betwe...
static const uint8_t IR_PT_LEFT_ADC
static const uint8_t IR_PT_FRONT_ADC
static const uint8_t IR_PT_RIGHT_ADC
static void begin(void)
initialize the Lightdetection Compnent, must be called before the other methods are used.