Dezibot 4
LightDetection.h
Go to the documentation of this file.
1 
12 #ifndef LightDetection_h
13 #define LightDetection_h
14 #include <stdint.h>
15 #include <Arduino.h>
16 
17 
18 
26 };
27 
31  uint32_t timeBetween;
32  uint16_t result;
33  bool done;
34 };
35 
36 enum ptType{
37  IR,
39 };
40 static const photoTransistors allIRPTs[] = {IR_FRONT,IR_LEFT,IR_RIGHT,IR_BACK};
41  static const photoTransistors allDLPTs[] = {DL_BOTTOM,DL_FRONT};
42 
43 
45 public:
50  static void begin(void);
51 
58  static uint16_t getValue(photoTransistors sensor);
59 
68 
77  static uint32_t getAverageValue(photoTransistors sensor, uint32_t measurments, uint32_t timeBetween);
78 protected:
79  static const uint8_t IR_PT_FRONT_ADC = 3;
80  static const uint8_t IR_PT_LEFT_ADC = 4;
81  static const uint8_t IR_PT_RIGHT_ADC = 5;
82  static const uint8_t IR_PT_BACK_ADC = 6;
83 
84  static const uint8_t DL_PT_FRONT_ADC = 7;
85  static const uint8_t DL_PT_BOTTOM_ADC = 8;
86 
87  static const uint8_t DL_PT_ENABLE = 41;
88  static const uint8_t IR_PT_ENABLE = 40;
89 
90 
91  static void beginInfrared(void);
92  static void beginDaylight(void);
93  static uint16_t readIRPT(photoTransistors sensor);
94  static uint16_t readDLPT(photoTransistors sensor);
95 
96 };
97 #endif //LightDetection_h
IR_RIGHT
@ IR_RIGHT
Definition: LightDetection.h:21
LightDetection::IR_PT_BACK_ADC
static const uint8_t IR_PT_BACK_ADC
Definition: LightDetection.h:82
LightDetection::begin
static void begin(void)
initialize the Lightdetection Compnent, must be called before the other methods are used.
Definition: LightDetection.cpp:4
LightDetection::IR_PT_LEFT_ADC
static const uint8_t IR_PT_LEFT_ADC
Definition: LightDetection.h:80
LightDetection::beginDaylight
static void beginDaylight(void)
Definition: LightDetection.cpp:75
LightDetection::DL_PT_BOTTOM_ADC
static const uint8_t DL_PT_BOTTOM_ADC
Definition: LightDetection.h:85
LightDetection::getValue
static uint16_t getValue(photoTransistors sensor)
reads the Value of the specified sensor
Definition: LightDetection.cpp:9
IR
@ IR
Definition: LightDetection.h:37
LightDetection::DL_PT_FRONT_ADC
static const uint8_t DL_PT_FRONT_ADC
Definition: LightDetection.h:84
IR_LEFT
@ IR_LEFT
Definition: LightDetection.h:20
averageMeasurement
Definition: LightDetection.h:28
DAYLIGHT
@ DAYLIGHT
Definition: LightDetection.h:38
averageMeasurement::sensor
photoTransistors sensor
Definition: LightDetection.h:29
IR_BACK
@ IR_BACK
Definition: LightDetection.h:23
IR_FRONT
@ IR_FRONT
Definition: LightDetection.h:22
LightDetection::IR_PT_RIGHT_ADC
static const uint8_t IR_PT_RIGHT_ADC
Definition: LightDetection.h:81
LightDetection::IR_PT_FRONT_ADC
static const uint8_t IR_PT_FRONT_ADC
Definition: LightDetection.h:79
ptType
ptType
Definition: LightDetection.h:36
DL_FRONT
@ DL_FRONT
Definition: LightDetection.h:24
LightDetection::beginInfrared
static void beginInfrared(void)
Definition: LightDetection.cpp:66
photoTransistors
photoTransistors
Definition: LightDetection.h:19
LightDetection::getBrightest
static photoTransistors getBrightest(ptType type)
can be used to determine which sensor is exposed to the greatest amount of light Can distingish betwe...
Definition: LightDetection.cpp:26
LightDetection::readIRPT
static uint16_t readIRPT(photoTransistors sensor)
Definition: LightDetection.cpp:82
averageMeasurement::done
bool done
Definition: LightDetection.h:33
averageMeasurement::result
uint16_t result
Definition: LightDetection.h:32
LightDetection::IR_PT_ENABLE
static const uint8_t IR_PT_ENABLE
Definition: LightDetection.h:88
averageMeasurement::timeBetween
uint32_t timeBetween
Definition: LightDetection.h:31
DL_BOTTOM
@ DL_BOTTOM
Definition: LightDetection.h:25
LightDetection::getAverageValue
static uint32_t getAverageValue(photoTransistors sensor, uint32_t measurments, uint32_t timeBetween)
Get the Average of multiple measurments of a single PT.
Definition: LightDetection.cpp:54
averageMeasurement::measurementAmount
uint32_t measurementAmount
Definition: LightDetection.h:30
LightDetection::readDLPT
static uint16_t readDLPT(photoTransistors sensor)
Definition: LightDetection.cpp:106
LightDetection::DL_PT_ENABLE
static const uint8_t DL_PT_ENABLE
Definition: LightDetection.h:87
LightDetection
Definition: LightDetection.h:44