So I have been looking around online for ways to use the MagiQuest wand at home, but have found very few solutions. I decided to make my own. Using the Arduino IR library I got some raw values from the wand using a old IR sensor from a VCR and then took those values and converted them from decimal to hex value using an online calculator. I just googled it and found one. Then made up some code that detected when a certain IR code was detected to activate my relay board and turn some lights off and on. My hook up is the IR sensor is on a breadboard connected to the Arduino, then I have jumper cabled hooked into a IDE cable because I only have male to male jumpers, then the IDE cable hooks into the relay board activating the relays. Right now I have 3 wands that the Arduino can interact with I can add more though.
#include <IRremote.h>
int RECV_PIN = 3; //
int led1 = 5;
int led2 = 6;
int led3 = 9;
int itsONled[] = {0,0,0,0};
#define code1 //Place your IR codes here
#define code2
#define code3
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
pinMode(led1, OUTPUT);
pinMode(led3, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
unsigned int value = results.value;
switch(value) {
case code1:
if(itsONled[1] == 1) {
digitalWrite(led1, LOW);
itsONled[1] = 0;
} else {
digitalWrite(led1, HIGH);
itsONled[1] = 1;
}
break;
case code2:
if(itsONled[2] == 1) {
digitalWrite(led2, LOW);
itsONled[2] = 0;
} else {
digitalWrite(led2, HIGH);
itsONled[2] = 1;
}
break;
case code3:
if(itsONled[3] == 1) {
digitalWrite(led3, LOW);
itsONled[3] = 0;
} else {
digitalWrite(led3, HIGH);
itsONled[3] = 1;
}
break;
}
Serial.println(value);
irrecv.resume();
}
}