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 
25  DL_BOTTOM
26 };
27 
31  uint32_t timeBetween;
32  uint16_t result;
33  bool done;
34 };
35 
36 enum ptType{
37  IR,
38  DAYLIGHT
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
photoTransistors
@ IR_LEFT
@ DL_BOTTOM
@ IR_RIGHT
@ IR_FRONT
@ DL_FRONT
@ IR_BACK
ptType
@ IR
@ DAYLIGHT
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.
photoTransistors sensor
uint32_t measurementAmount