Dezibot 4
InfraredLight.h
Go to the documentation of this file.
1
11
#ifndef InfraredLight_h
12
#define InfraredLight_h
13
#include <stdint.h>
14
#include <Arduino.h>
15
#include "driver/ledc.h"
16
17
18
class
InfraredLED
{
19
public
:
20
InfraredLED
(uint8_t pin, ledc_timer_t
timer
, ledc_channel_t
channel
);
21
void
begin
(
void
);
26
void
turnOn
(
void
);
32
void
turnOff
(
void
);
39
void
setState
(
bool
state);
46
void
sendFrequency
(uint16_t frequency);
47
protected
:
48
uint8_t
ledPin
;
49
ledc_timer_t
timer
;
50
ledc_channel_t
channel
;
51
ledc_timer_config_t
pwmTimer
;
52
ledc_channel_config_t
pwmChannel
;
53
};
54
55
class
InfraredLight
{
56
public
:
57
//Do something for correct resource sharing
58
InfraredLED
bottom
=
InfraredLED
(
IRBottomPin
,LEDC_TIMER_0,LEDC_CHANNEL_0);
59
InfraredLED
front
=
InfraredLED
(
IRFrontPin
,LEDC_TIMER_1,LEDC_CHANNEL_1);
60
void
begin
(
void
);
61
62
protected
:
63
static
const
uint8_t
IRFrontPin
= 14;
64
static
const
uint8_t
IRBottomPin
= 13;
65
};
66
67
68
#endif //InfraredLight_h
InfraredLED::InfraredLED
InfraredLED(uint8_t pin, ledc_timer_t timer, ledc_channel_t channel)
Definition:
InfraredLED.cpp:5
InfraredLED::turnOn
void turnOn(void)
enables selected LED
Definition:
InfraredLED.cpp:34
InfraredLED::ledPin
uint8_t ledPin
Definition:
InfraredLight.h:48
InfraredLED::pwmChannel
ledc_channel_config_t pwmChannel
Definition:
InfraredLight.h:52
InfraredLED::sendFrequency
void sendFrequency(uint16_t frequency)
starts flashing the IRLed with a specific frequency Won't stop automatically, must be stopped by call...
Definition:
InfraredLED.cpp:53
InfraredLight::front
InfraredLED front
Definition:
InfraredLight.h:59
InfraredLED::timer
ledc_timer_t timer
Definition:
InfraredLight.h:49
InfraredLED::pwmTimer
ledc_timer_config_t pwmTimer
Definition:
InfraredLight.h:51
InfraredLED::turnOff
void turnOff(void)
disables selected LED
Definition:
InfraredLED.cpp:38
InfraredLight::IRFrontPin
static const uint8_t IRFrontPin
Definition:
InfraredLight.h:63
InfraredLight::bottom
InfraredLED bottom
Definition:
InfraredLight.h:58
InfraredLED
Definition:
InfraredLight.h:18
InfraredLight
Definition:
InfraredLight.h:55
InfraredLED::setState
void setState(bool state)
changes state of selected LED depending on the state
Definition:
InfraredLED.cpp:42
InfraredLED::channel
ledc_channel_t channel
Definition:
InfraredLight.h:50
InfraredLight::IRBottomPin
static const uint8_t IRBottomPin
Definition:
InfraredLight.h:64
InfraredLED::begin
void begin(void)
Definition:
InfraredLED.cpp:11
InfraredLight::begin
void begin(void)
Definition:
InfraredLight.cpp:3
src
infraredLight
InfraredLight.h
Generated by
1.8.17