Things used in this project


Energia Code ExampleC/C++
This is the main sketch for making the appropriate RESTful API call to the IFTTT Maker Channel. The TI LaunchPad attaches an interrupt to one of the on-board push buttons. When the button is pressed, the LaunchPad does an HTTP Post to the IFTTT cloud to trigger an event. This event then triggers a push notification through the Boxcar 2 channel in IFTTT.
  Repeating Wifi Web Client

 This sketch connects to a a web server and makes a request

 * WiFi shield attached to pins SPI pins and pin 7

 created 23 April 2012
 modified 31 May 2012
 by Tom Igoe
 modified 13 Jan 2014
 by Federico Vanzati
 modified 6 July 2014
 by Noah Luskey
 modified 12 Oct 2015
 by Adrian Fernandez (IFTTT trigger)

 This code is in the public domain.

 * CC3200 WiFi LaunchPad or CC3100 WiFi BoosterPack
   with TM4C or MSP430 LaunchPad

#ifndef __CC3200R1M1RGC__
// Do not include SPI for CC3200 LaunchPad
#include <SPI.h>
#include <WiFi.h>

// your network name also called SSID
char ssid[] = "YOUR_SSID";
// your network password
char password[] = "YOUR_PASSWORD";

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(50,62,217,1);  // numeric IP for Google (no DNS)
char server[] = "";    // name address for Google (using DNS)

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
WiFiClient client;

int trigger = 0;

void setup() {
  //Initialize serial and wait for port to open:

  // attempt to connect to Wifi network:
  Serial.print("Attempting to connect to Network named: ");
  // print the network name (SSID);
  // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
  WiFi.begin(ssid, password);
  while ( WiFi.status() != WL_CONNECTED) {
    // print dots while we wait to connect
  Serial.println("\nYou're connected to the network");
  Serial.println("Waiting for an ip address");
  while (WiFi.localIP() == INADDR_NONE) {
    // print dots while we wait for an ip addresss

  Serial.println("\nIP Address obtained");
  // We are connected and have an IP address.
  // Print the WiFi status.
  /* Enable internal pullup. 
   * Without the pin will float and the example will not work */
  attachInterrupt(PUSH2, sendRequest, FALLING); // Interrupt is fired whenever button is pressed
  Serial.println("Push the button!");

void loop() {
  String IFTTT_EVENT = "button_pressed"; // IFTTT Maker Event Name here
  if(trigger == 1){
    ifttt_trigger(IFTTT_KEY, IFTTT_EVENT); 
    Serial.println("Push the button!");
    trigger = 0;


// This method makes a HTTP connection to the server & does a GET request for user name
// Simply pass in the badge ID to query as a String.
// Returns string:
//   - Returns "<NAME>"if badge ID is registered
//   - Returns "NULL" if badge ID is not registered
//   - Returns "FAIL" if REST API failed
String ifttt_trigger(String KEY, String EVENT) {
  String name = "";
  // close any connection before send a new request.
  // This will free the socket on the WiFi shield

  // if there's a successful connection:
  if (client.connect(server, 80)) {
    // This is optional. You can send additional data to IFTTT along with your HTTP POST that triggers the action
    String PostData = "{\"value1\" : \"testValue\", \"value2\" : \"Hello\", \"value3\" : \"World!\" }";
    Serial.println("connected to server... Getting name...");
    // send the HTTP PUT request:
    String request = "POST /trigger/";
    request += EVENT;
    request += "/with/key/";
    request += KEY;
    request += " HTTP/1.1";
    client.println("User-Agent: Energia/1.1");
    client.println("Connection: close");
    client.println("Content-Type: application/json");
    client.print("Content-Length: ");

  else {
    // if you couldn't make a connection:
    Serial.println("Connection failed");
    return "FAIL"; // rest API failed...
  // Capture response from the server. (10 second timeout)
  long timeOut = 4000;
  long lastTime = millis();
  while((millis()-lastTime) < timeOut){  // Wait for incoming response from server
    while (client.available()) {         // Characters incoming from the server
      char c =;            // Read characters
  Serial.println("Request Complete!");
  //return name; // Return the complete name received from server
  return "SUCCESS";

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");

  // print your WiFi IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(" dBm");

void sendRequest(){
  if(trigger == 0){
    trigger = 1;



Did you replicate this project? Share it!

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

Give feedback


Similar projects you might like

Boost Your Google Home With Prota OS for RPi
  • 1,430
  • 7

Full instructions

Extend your Google Home features to smart light, smart speakers, smart cam and smart appliances with those DIY tricks based on Raspberry Pi.

Google Home - Control DIY Devices
  • 832
  • 8

Full instructions

This project show how to control multiple IoT devices using Google Home.

DIY Smart Home Automation for Everyone
  • 1,478
  • 15

Full instructions

Smart Home automation made easy and accessible for anyone, for little budget and no skills needed with Prota OS on Raspberry Pi

MyPIR-Sensor Informs Me Via IFTTT
  • 233
  • 1

Full instructions

Cheap & easy alarm-system.

Thirsty Tweeting Office Plants
  • 1,633
  • 14

Full instructions

We're pretty good at maintaining our code base, not so much at maintaining our office plants. We use Arduino to keep our plants alive.

Text Machine, Get Gumball
  • 6
  • 0

This project describes how to build an Arduino-based, text-controlled gum dispenser

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login