Giovanni Gentile
Published © LGPL

Pebble + Photon = IoT Watch Switch

When I arrive in my house I switch on the light with my Pebble Watch! The procedure to make this is very simple.

IntermediateFull instructions provided2 hours336
Pebble + Photon = IoT Watch Switch

Things used in this project

Hardware components

Photon
Particle Photon
×1
Pebble Watch
Pebble Watch
×1
SparkFun Breadboard Power Supply Stick 5V/3.3V
SparkFun Breadboard Power Supply Stick 5V/3.3V
×1

Software apps and online services

Maker service
IFTTT Maker service
Particle IDE

Story

Read more

Code

Particle Photon Switch code

Arduino
int controlLed(String command);

void setup()
{
  pinMode(7, OUTPUT);
  digitalWrite(7,LOW);
  // register the cloud function
  Particle.function("particle", controlLed); // the name of function on IFTTT
}

void loop()
{
  // this loops forever
}

// this function automagically gets called upon a matching POST request
int controlLed(String command)
{
  // look for the matching argument "coffee" <-- max of 64 characters long
  if(command == "on")
  {
    digitalWrite(7,HIGH);
    return 1;
  }
  else if(command == "off")
  {
    digitalWrite(7,LOW);
    return 1;
  }
  else return -1;
}

Credits

Giovanni Gentile

Giovanni Gentile

1 project • 42 followers
Graduated in Psychology expert in new technologies and communication, with expertise in electronics, automation and home automation.
Contact

Comments

Add projectSign up / Login