29 lines
933 B
C++
Executable File
29 lines
933 B
C++
Executable File
/* send.ino Example sketch for IRLib2
|
|
* Illustrates how to send a code.
|
|
*/
|
|
#include <IRLibSendBase.h> // First include the send base
|
|
//Now include only the protocols you wish to actually use.
|
|
//The lowest numbered protocol should be first but remainder
|
|
//can be any order.
|
|
#include <IRLib_P01_NEC.h>
|
|
#include <IRLib_P02_Sony.h>
|
|
#include <IRLibCombo.h> // After all protocols, include this
|
|
// All of the above automatically creates a universal sending
|
|
// class called "IRsend" containing only the protocols you want.
|
|
// Now declare an instance of that sender.
|
|
|
|
IRsend mySender;
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
//delay(2000); while (!Serial); //delay for Leonardo
|
|
Serial.println(F("Every time you press a key is a serial monitor we will send."));
|
|
}
|
|
|
|
void loop() {
|
|
if (Serial.read() != -1) {
|
|
mySender.send(NEC,0x61a0f00f,0);//NEC TV power button=0x61a0f00f
|
|
Serial.println(F("Sent signal."));
|
|
}
|
|
}
|