Snippets
Created by
Jason Matusiak
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /* autoResume.ino Example sketch for IRLib2
Illustrates how to receive an IR signal, decode it and print
information about it to the serial monitor.
Uses an external buffer in the auto resume feature.
*/
/*
//This includes everything. Not generally recommended.
//It's better to include only the parts of library you really need.
//But for this example it's quick and easy. See "comboDump" example
//for a more efficient way.
#include "IRLibAll.h"
IRrecvPCI myReceiver(2); //create receiver and pass pin number
IRdecode myDecoder; //create decoder
//Create a buffer that we will use for decoding one stream while
//the receiver is using the default buffer "recvGlobal.recvBuffer"
uint16_t myBuffer[RECV_BUF_LENGTH];
void setup() {
Serial.begin(9600);
delay(2000); while (!Serial); //delay for Leonardo
//Enable auto resume and pass it the address of your extra buffer
myReceiver.enableAutoResume(myBuffer);
myReceiver.enableIRIn(); // Start the receiver
Serial.println(F("Ready to receive IR signals"));
}
void loop() {
//Continue looping until you get a complete signal received
if (myReceiver.getResults()) {
myDecoder.decode(); //Decode it
myDecoder.dumpResults(true); //Now print results. Use false for less detail
myReceiver.enableIRIn(); //Restart receiver
}
}
*/
/* 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 <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.
const uint32_t POWER = 0x00FFA25D;
const uint32_t MENU = 0x00FF22DD;
const uint32_t UP = 0x00FFA857;
const uint32_t DOWN = 0x00FF18E7;
const uint32_t LEFT = 0x00FF6897;
const uint32_t RIGHT = 0x00FFB04F;
const uint32_t OK = 0x00FF9867;
const uint32_t RTN = 0x00FF42BD;
const uint32_t PLPAU = 0x00FF4AB5;
const uint32_t GAP = 0xFFFFFFFF;
IRsend mySender;
void setup() {
Serial.begin(9600);
delay(2000); while (!Serial);
Serial.println("Starting IR transmit procedures");
}
void sendCMD(uint32_t cmd)
{
mySender.send(NEC,cmd,0);
delay(250);
}
void loop() {
//power up the unit
Serial.println("Powering up the unit");
sendCMD(POWER);
//delay 25 seconds for the unit to power up
Serial.println("Delaying 25 seconds for power up process");
//delay(30000);
unsigned long interval=25000; // the time we need to wait
unsigned long previousMillis=0; // millis() returns an unsigned long.
unsigned long currentMillis = millis(); // grab current time
while ((unsigned long)(millis() - currentMillis) < interval) {}
//setup the system to run for 300 minutes
Serial.println("Setting timer for 300 minutes");
sendCMD(MENU);
sendCMD(MENU);
sendCMD(RIGHT);
sendCMD(RIGHT);
sendCMD(OK);
for(int i = 0; i < 10; i++)
{
sendCMD(DOWN);
}
sendCMD(MENU);
sendCMD(MENU);
//Select videos as the option to play
Serial.println("Select Video as the option to play");
sendCMD(LEFT);
sendCMD(OK);
//select SD card as source
Serial.println("Selecting SD card as source");
sendCMD(OK);
//select vertical orientation
Serial.println("Selecting vertical orientation folder");
sendCMD(RIGHT);
sendCMD(RIGHT);
sendCMD(OK);
//select Christmas folder
Serial.println("Selecting Christmas folder");
sendCMD(RIGHT);
sendCMD(RIGHT);
sendCMD(OK);
//select the Christmas clips to show
Serial.println("Selecting the clips to play");
for(int i = 0; i < 4; i++)
{
sendCMD(RIGHT);
}
sendCMD(OK);
//select the Christmas clips to show
for(int i = 0; i < 3; i++)
{
sendCMD(RIGHT);
sendCMD(OK);
}
//play the clips!!!!
Serial.println("Playing the clips!!!!!");
sendCMD(PLPAU);
//loop forever since your work is done!
Serial.println("Until tomorrow night, my work here is done....");
while(1){}
}
|
Comments (0)
You can clone a snippet to your computer for local editing. Learn more.