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!

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

Developing a Low-Cost Microcentrifuge Using E-Waste
Intermediate
  • 109
  • 3

Work in progress

Quality microcentrifuges are generally too expensive for most people to afford. This project aims to provide a low-cost alternative.

SMART CUBE: A New Way to Control Your Home
Intermediate
  • 619
  • 5

Full instructions

Discover a new way to interact with your smart home thanks to Arduino 101: tilt and shake the cube to control your devices via Bluetooth!

Self-Balancing Rover With Thermometer
Intermediate
  • 190
  • 3

Full instructions

My partner Jiahao Zhao and I designed, built, debugged, and finished this project in only three days !

SONOFF Dual MQTT Tutorial: Control Your Home Remotely for $9
Intermediate
  • 331
  • 6

Full instructions

This $9 Wi-Fi relay can control two appliances at the same time. Learn how to connect it to Ubidots and unleash its full potential!

Avoid Injuries with Smart Backpack
Intermediate
  • 974
  • 12

Full instructions

Smart Backpack helps you to avoid injuries caused by backpacks by alerting you about improper uses.

RC Car to BT Car controlled with Blynk
Intermediate
  • 59
  • 1

Full instructions

Converting a common RC car to Bluetooth Car, using an Arduino 101 y controlling with a Smartphone via Blynk App

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback