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

Blynk GPS Tracker
Intermediate
  • 191
  • 5

Full instructions

Simple GPS tracker using a Particle Photon (or Electron) and an EM406 GPS module with location visible on Blynk app map.

Arduino101 Bluetooth Interfacing
Intermediate
  • 200
  • 4

Full instructions

Use the Arduino101 Bluetooth wireless interface with the Blynk GUI Library for control of things directly from your phone or tablet !

Amazon Echo – Read Temperature and Humidity from Sensor
Intermediate
  • 323
  • 12

Full instructions

I am going to show how to use Amazon Echo to read temperature and humidity from sensor.

Smart Garden
Intermediate
  • 2,491
  • 19

Smart Garden is a plant environmental monitoring system.

FPGA Plant Model powerSUITE Buck/Boost Real Time
Intermediate
  • 69
  • 2

Protip

Allows quick evaluation of Power Supply Plant parameters for TI Buck_VMC_F2837xS project.

Arduino101 Bluetooth Intertial Measurement Unit (IMU)
Intermediate
  • 76
  • 1

Full instructions

Use the Arduino101 Bluetooth wireless interface to read the Intertial Measurement Unit (IMU) with your phone or tablet using Blynk !

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback