Infrared4Arduino
IrSenderNonMod.cpp
Go to the documentation of this file.
1 /*
2 Copyright (C) 2015 Bengt Martensson.
3 
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or (at
7 your option) any later version.
8 
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along with
15 this program. If not, see http://www.gnu.org/licenses/.
16 */
17 
18 #include "IrSenderNonMod.h"
19 
21 }
22 
24  for (unsigned int i = 0; i < irSequence.getLength(); i++) {
25  digitalWrite(getOutputPin(), (i & 1) ? LOW : HIGH);
26  delayUSecs(irSequence.getDurations()[i]);
27  }
28  digitalWrite(getOutputPin(), LOW);
29 }
uint8_t pin_t
Type for GPIO pin, compatible with Arduino libs.
Definition: InfraredTypes.h:40
void sendNonModulated(const IrSequence &irSequence)
Sends the IrSequence as argument.
Abstract base class for all sending classes.
Definition: IrSender.h:27
void delayUSecs(microseconds_t T)
Definition: IrSender.cpp:25
pin_t getOutputPin() const
Definition: IrSender.h:32
size_t getLength() const
Returns the length of the data.
Definition: IrSequence.h:49
const microseconds_t * getDurations() const
Definition: IrSequence.h:57
This class consists of a vector of durations.
Definition: IrSequence.h:12
IrSenderNonMod(pin_t pin)