Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@samdup
Last active June 11, 2016 10:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samdup/680fbe19bd1e94e68129 to your computer and use it in GitHub Desktop.
Save samdup/680fbe19bd1e94e68129 to your computer and use it in GitHub Desktop.
#include "InternetButton/InternetButton.h"
InternetButton b = InternetButton();
void setup() {
b.begin();
}
void loop(){
// Cycle three "bright" brightness states when you click the first button (at the 12 o'clock position)
if(b.buttonOn(1)){
Spark.publish("LIFX_cycle_beta1", "{ \"parameter\": \"brightness\", \"cycle1\": \"1\", \"cycle2\": \"0.8\", \"cycle3\": \"0.6\"}");
delay(500);
}
// Cycle two "dim" brightness states and "off" when you click the third button (at the 6 o'clock position)
if(b.buttonOn(3)){
Spark.publish("LIFX_cycle_beta1", "{ \"parameter\": \"brightness\", \"cycle1\": \"0.4\", \"cycle2\": \"0.2\", \"cycle3\": \"0\"}");
delay(500);
}
// Cycle three "warm" color states when you click the second button (at the 3 o'clock position)
if(b.buttonOn(2)){
Spark.publish("LIFX_cycle_beta1", "{ \"parameter\": \"color\", \"cycle1\": \"white\", \"cycle2\": \"orange\", \"cycle3\": \"red\"}");
delay(500);
}
// Cycle three "cool" color states when you click the third button (at the 9 o'clock position)
if(b.buttonOn(4)){
Spark.publish("LIFX_cycle_beta1", "{ \"parameter\": \"color\", \"cycle1\": \"purple\", \"cycle2\": \"blue\", \"cycle3\": \"green\"}");
delay(500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment