Neltner Labs

Fun Projects and Art

SaikoLED Show & Tell: Episode 1

In this episode, we show you just how easy it is to make a myki (or Arduino) remote-controlled.
This setup is a likely candidate for one of our first expansion kits to be released after crowdfunding… but why wait? Do it now with a TSOP382 and your own remote!

Arduino code for this demo is as follows below the break:

 
/* myki 8bit IR
 *  A simple IR detection script that turns lights on and off
* Hardware needed: TSOP382 + remote + myki Light
* * Copyleft 2013 Dan Taub for SaikoLED * IR Library available from https://github.com/shirriff/Arduino-IRremote */ #include <IRremote.h> // Input on MOSI which is GPIO 16 int RECV_PIN = 16; IRrecv irrecv(RECV_PIN); decode_results results; // NOTE: Pin mappings for OLD prototype #define redPin 13 #define greenPin 9 #define bluePin 11 #define whitePin 10 #define delaytime 1 void lightsoff(){ digitalWrite(whitePin, 0); digitalWrite(redPin, 0); digitalWrite(greenPin, 0); digitalWrite(bluePin, 0); } void setup() { // Start the receiver irrecv.enableIRIn(); // Configure LED pins. pinMode(whitePin, OUTPUT); pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); // Turn all LEDS off. lightsoff(); // Start debug connection Serial.begin(9600); } void loop(){ if (irrecv.decode(&results)){ // Ignore anything ending in 0xFF if ((results.value & 0x0FF) == 0x0FF){} else{ // Print value of button pressed over USB Serial.println(results.value,HEX); // Before executing a command, turn off the LEDs // NOTE: This means unrecognized signals will turn off the light. lightsoff(); } switch(results.value & 0x0FF){ case 0x7F: digitalWrite(redPin, 1); break; case 0xBF: digitalWrite(greenPin, 1); break; case 0x3F: digitalWrite(bluePin, 1); break; case 0x67: digitalWrite(whitePin, 1); break; } // Receive the next value irrecv.resume(); } else{ // no data coming in. do nothing // maybe do something like slowly fading away } delay(delaytime); }