-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathIRSenderBlaster.cpp
More file actions
42 lines (31 loc) · 779 Bytes
/
IRSenderBlaster.cpp
File metadata and controls
42 lines (31 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "HeatpumpIRCompat.h"
#include <IRSender.h>
// Send IR using the IR Blaster. The IR Blaster generates the 38 kHz carrier frequency
IRSenderBlaster::IRSenderBlaster(uint8_t pin) : IRSender(pin)
{
pinMode(_pin, OUTPUT);
}
void IRSenderBlaster::setFrequency(int frequency)
{
(void)frequency;
}
// Send an IR 'mark' symbol, i.e. transmitter ON
void IRSenderBlaster::mark(int markLength)
{
digitalWrite(_pin, HIGH);
if (markLength < 16383) {
delayMicroseconds(markLength);
} else {
delay(markLength/1000);
}
}
// Send an IR 'space' symbol, i.e. transmitter OFF
void IRSenderBlaster::space(int spaceLength)
{
digitalWrite(_pin, LOW);
if (spaceLength < 16383) {
delayMicroseconds(spaceLength);
} else {
delay(spaceLength/1000);
}
}