This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// To start out we're going to define some things to allow for cleaner code below; let's start with our twitter auth info: | |
// | |
#define TWITTER_OAUTH "ENTER YOUR ACCESS TOKEN HERE" | |
#define LIB_DOMAIN "arduino-tweet.appspot.com" | |
// | |
// lets be good Twitter citizens and limit the number of times our pumpkins tweets when it's calm. Below you can see it's set to | |
// send a calm tweet every 45 minutes at the absolute most. It will send an "alarm" tweet only every minute | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This #include statement was automatically added by the Spark IDE. | |
#include "neopixel/neopixel.h" | |
// 'Firewalker' LED sneakers sketch for Adafruit NeoPixels by Phillip Burgess | |
const uint8_t gamma[] = { // Gamma correction table for LED brightness | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, | |
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, | |
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define TWITTER_OAUTH "___insert_your_oauth_string_here___" | |
#define LIB_DOMAIN "arduino-tweet.appspot.com" | |
#pragma SPARK_NO_PREPROCESSOR | |
// In case we're compiling locally: | |
#include "application.h" | |
void next_alarm_tweet(); | |
void next_calm_tweet() ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This #include statement was automatically added by the Spark IDE. | |
#include "neopixel/neopixel.h" | |
// IMPORTANT: Set pixel COUNT, PIN and TYPE | |
#define PIXEL_PIN D2 | |
#define PIXEL_COUNT 300 | |
#define PIXEL_TYPE WS2812B | |
int reds[PIXEL_COUNT]; | |
int greens[PIXEL_COUNT]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "application.h" | |
class TempSensor { | |
public: | |
char *id ; | |
uint8_t rom[8]; | |
float value ; | |
int updated = 0; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned int last_heartbeat = 0; | |
#define HEARTBEAT_PERIOD_SECONDS 60 | |
#define MAX_MISSED_HEARTBEATS 3 | |
void setup() { | |
Serial.begin(115200); | |
Spark.subscribe("heartbeat", heartbeat_handler); | |
//Spark.subscribe("heartbeat", heartbeat_handler, MY_DEVICES); | |
last_heartbeat = millis(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
Spark.function("nyan", nyanHandler); | |
} | |
void loop() { | |
//nothing to see here! | |
} | |
int nyanHandler(String cmd) { | |
if (cmd == "on") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define AUTO_OFF 1 /* minutes */ | |
unsigned int lastOn = 0; | |
void setup() { | |
Spark.function("shoutRainbows", nyanHandler); | |
} | |
void loop() { | |
//nothing to see here! | |
if (lastOn > 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int laser = 0; | |
unsigned int lastPublish = 0; | |
bool lastState = false; | |
void setup() { | |
pinMode(A0, INPUT_PULLDOWN); | |
pinMode(D7, OUTPUT); | |
} | |
void loop() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SYSTEM_MODE(MANUAL); | |
void setup() { | |
Serial.begin(9600); | |
Serial1.begin(9600); | |
pinMode(D7, OUTPUT); | |
} | |
void loop() { | |
if (Serial1.available()) { |