Things used in this project

Code

smartBoseC/C++
The main energia sketch uploaded to the LaunchPad
#include <IRSendRev.h>
#define BIT_LEN         0
#define BIT_START_H     1
#define BIT_START_L     2
#define BIT_DATA_H      3
#define BIT_DATA_L      4
#define BIT_DATA_LEN    5
#define BIT_DATA        6
#define commandMax      4
const int ir_freq = 38;                 // 38k
IRSendRev IR;

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <WiFi.h>
#include <BlynkSimpleTI_CC3200_LaunchXL.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXX";

// Your WiFi credentials
char ssid[] = "XXXXX";
char pass[] = "XXXXX";        // Set to "" for open networks


struct cmd_t{
  unsigned char dta[20];
} IRout[commandMax];

 
void setup()
{
    dtaInit();
    IR.setSend(40);
    pinMode(pb1,INPUT_PULLUP);
    Serial.begin(9600);
    Blynk.begin(auth, ssid, pass);
}
  int i =0;
void loop()
{
  Blynk.run();
  if (digitalRead(pb1) == 0){
    //Serial.print("Sending IRout ");
    //Serial.println(i);
    IR.Send(IRout[i++].dta, 38);
    while(digitalRead(pb1) == 0){
    }
    if(i>3){
      i=0;
    }
  }
    delay(100);
}

void dtaInit()
{
    //Power
    IRout[0].dta[BIT_LEN]        = 9;			// all data that needs to be sent
    IRout[0].dta[BIT_START_H]    = 180;			// the logic high duration of "Start"
    IRout[0].dta[BIT_START_L]    = 91;			// the logic low duration of "Start"
    IRout[0].dta[BIT_DATA_H]     = 11;			// the logic "long" duration in the communication
    IRout[0].dta[BIT_DATA_L]     = 33;			// the logic "short" duration in the communication
    IRout[0].dta[BIT_DATA_LEN]   = 4;			// Number of data which will sent. If the number is other, you should increase or reduce dtaSend[BIT_DATA+x].
    IRout[0].dta[BIT_DATA+0]     = 93;			// data that will sent
    IRout[0].dta[BIT_DATA+1]     = 210;
    IRout[0].dta[BIT_DATA+2]     = 50;
    IRout[0].dta[BIT_DATA+3]     = 205;
    //Set Input
    IRout[1].dta[BIT_LEN]        = 9;			// all data that needs to be sent
    IRout[1].dta[BIT_START_H]    = 180;			// the logic high duration of "Start"
    IRout[1].dta[BIT_START_L]    = 91;			// the logic low duration of "Start"
    IRout[1].dta[BIT_DATA_H]     = 11;			// the logic "long" duration in the communication
    IRout[1].dta[BIT_DATA_L]     = 33;			// the logic "short" duration in the communication
    IRout[1].dta[BIT_DATA_LEN]   = 4;			// Number of data which will sent. If the number is other, you should increase or reduce dtaSend[BIT_DATA+x].
    IRout[1].dta[BIT_DATA+0]     = 93;			// data that will sent
    IRout[1].dta[BIT_DATA+1]     = 210;
    IRout[1].dta[BIT_DATA+2]     = 168;
    IRout[1].dta[BIT_DATA+3]     = 87;
    //Voluem Up
    IRout[2].dta[BIT_LEN]        = 9;			// all data that needs to be sent
    IRout[2].dta[BIT_START_H]    = 180;			// the logic high duration of "Start"
    IRout[2].dta[BIT_START_L]    = 91;			// the logic low duration of "Start"
    IRout[2].dta[BIT_DATA_H]     = 11;			// the logic "long" duration in the communication
    IRout[2].dta[BIT_DATA_L]     = 33;			// the logic "short" duration in the communication
    IRout[2].dta[BIT_DATA_LEN]   = 4;			// Number of data which will sent. If the number is other, you should increase or reduce dtaSend[BIT_DATA+x].
    IRout[2].dta[BIT_DATA+0]     = 93;			// data that will sent
    IRout[2].dta[BIT_DATA+1]     = 210;
    IRout[2].dta[BIT_DATA+2]     = 192;
    IRout[2].dta[BIT_DATA+3]     = 63;
    //Volume Down
    IRout[3].dta[BIT_LEN]        = 9;			// all data that needs to be sent
    IRout[3].dta[BIT_START_H]    = 180;			// the logic high duration of "Start"
    IRout[3].dta[BIT_START_L]    = 91;			// the logic low duration of "Start"
    IRout[3].dta[BIT_DATA_H]     = 11;			// the logic "long" duration in the communication
    IRout[3].dta[BIT_DATA_L]     = 33;			// the logic "short" duration in the communication
    IRout[3].dta[BIT_DATA_LEN]   = 4;			// Number of data which will sent. If the number is other, you should increase or reduce dtaSend[BIT_DATA+x].
    IRout[3].dta[BIT_DATA+0]     = 93;			// data that will sent
    IRout[3].dta[BIT_DATA+1]     = 210;
    IRout[3].dta[BIT_DATA+2]     = 64;
    IRout[3].dta[BIT_DATA+3]     = 191;
}
IRGroveC/C++
Seeed's arduino Library for the IR emitter modified for the TI Launchpad
No preview (download only).
BlynkLibC/C++
Modified Blynk library to work with CC3100 BoosterPack (small, debugging changes)
No preview (download only).
IR ReceiveC/C++
Used to receive an IR signal and print the results to the serial monitor. Helpful for trying to figure out codes to emit
#include <IRSendRev.h>
 
#define BIT_LEN         0
#define BIT_START_H     1
#define BIT_START_L     2
#define BIT_DATA_H      3
#define BIT_DATA_L      4
#define BIT_DATA_LEN    5
#define BIT_DATA        6
#define LED GREEN_LED 
const int pinRecv = 2;              // ir receiver connect to D2
IRSendRev IR; 
    boolean state = 0;
void setup()
{
    Serial.begin(115200);
    IR.Init(5);
    Serial.println("init over");
    pinMode(LED,OUTPUT);

    digitalWrite(LED,LOW);
}
 
unsigned char dta[20];
 
void loop()
{
    if(IR.IsDta())                  // get IR data
    {
        IR.Recv(dta);               // receive data to dta
 
        Serial.println("+------------------------------------------------------+");
		Serial.print("LEN = ");
        Serial.println(dta[BIT_LEN]);
        Serial.print("START_H: ");
        Serial.print(dta[BIT_START_H]);
        Serial.print("\tSTART_L: ");
        Serial.println(dta[BIT_START_L]);
 
        Serial.print("DATA_H: ");
        Serial.print(dta[BIT_DATA_H]);
        Serial.print("\tDATA_L: ");
        Serial.println(dta[BIT_DATA_L]);
 
        Serial.print("\r\nDATA_LEN = ");
        Serial.println(dta[BIT_DATA_LEN]);
 
		Serial.print("DATA: ");
        for(int i=0; i<dta[BIT_DATA_LEN]; i++)
        {
            Serial.print("0x");
            Serial.print(dta[i+BIT_DATA], HEX);
            Serial.print("\t");
        }
        Serial.println();
 
		Serial.print("DATA: ");
        for(int i=0; i<dta[BIT_DATA_LEN]; i++)
        {
            Serial.print(dta[i+BIT_DATA], DEC);
            Serial.print("\t");
        }
        Serial.println();
        Serial.println("+------------------------------------------------------+\r\n\r\n");
    }
    if(dta[BIT_DATA] == 100){
      state = !state;
      digitalWrite(LED,state);
    }
    dta[BIT_DATA] = 0;
}

Credits

81a21a12aab58cdfe8d1306c85500e45
Chris Roberts

I am an applications engineer with Texas Instruments working with the Launchpad by trade, and a maker by passion!

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Upload code to TI TM4C123 using Linux, CMake and lm4tools
Intermediate
  • 43
  • 2

Protip

This is a step by step guide on how to get CMake and lm4tools setup in a Linux environment to upload code directly to your TM4C123 via usb.

Die Losungen - every day a new bible verse
Intermediate
  • 53
  • 1

Full instructions

You love daily changing bible verse? Then the "Die Losungen" are a concept: here they are represented with value added information

Handheld Game Console: Zombieland
Intermediate
  • 649
  • 10

Full instructions

Fun and cool TI LaunchPad game console that allows you to play the game called Zombieland!

LoRaCatKitty Build IoT Applications with LoRaWAN in 3 Steps
Intermediate
  • 1,106
  • 7

Protip

LoRaCatKitty Build IoT Applications with LoRaWAN in 3 steps with The Thing Networks and Cayenne.

Build Your Own Amazon Echo Using a RPI and ReSpeaker HAT
Intermediate
  • 6,516
  • 33

Full instructions

How to build your own Amazon Echo using a Raspberry Pi and ReSpeaker 2-Mics HAT.

Android App-Based Home Automation System Using IOT
Intermediate
  • 2,756
  • 19

Full instructions

Control and monitor the home environment using Android app with advanced features such as voice command, scheduling, home preparing itself.

Sign up / LoginProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlog