Skip to content

Instantly share code, notes, and snippets.

View dmiddlecamp's full-sized avatar

David Middlecamp dmiddlecamp

View GitHub Profile
//
// 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
//
@dmiddlecamp
dmiddlecamp / firewalker_spark.ino
Created October 30, 2014 01:58
untested quick port of firewalker code!
// 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,
@dmiddlecamp
dmiddlecamp / mousetrap
Created November 6, 2014 23:23
Latest Mousetrap Code
#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() ;
@dmiddlecamp
dmiddlecamp / holiday_strip.ino
Last active August 29, 2015 14:11
Holiday Strip code
// 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];
@dmiddlecamp
dmiddlecamp / TempSensor.h
Last active August 29, 2015 14:12
latest temp sensor package
#include "application.h"
class TempSensor {
public:
char *id ;
uint8_t rom[8];
float value ;
int updated = 0;
};
@dmiddlecamp
dmiddlecamp / main.ino
Created January 8, 2015 16:29
a workaround to detect and recover when event subscriptions are lost
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();
}
@dmiddlecamp
dmiddlecamp / nyan.ino
Created January 20, 2015 20:17
Sample Spark.function 'nyan' / rainbow firmware!
void setup() {
Spark.function("nyan", nyanHandler);
}
void loop() {
//nothing to see here!
}
int nyanHandler(String cmd) {
if (cmd == "on") {
@dmiddlecamp
dmiddlecamp / nyan.ino
Created January 20, 2015 20:34
Slightly more fancy version with auto-off
#define AUTO_OFF 1 /* minutes */
unsigned int lastOn = 0;
void setup() {
Spark.function("shoutRainbows", nyanHandler);
}
void loop() {
//nothing to see here!
if (lastOn > 0) {
@dmiddlecamp
dmiddlecamp / laser.ino
Created January 22, 2015 01:49
keen laser code
int laser = 0;
unsigned int lastPublish = 0;
bool lastState = false;
void setup() {
pinMode(A0, INPUT_PULLDOWN);
pinMode(D7, OUTPUT);
}
void loop() {
@dmiddlecamp
dmiddlecamp / serial_bridge
Last active August 29, 2015 14:14
pipe serial1 -> serial and vice versa
SYSTEM_MODE(MANUAL);
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
pinMode(D7, OUTPUT);
}
void loop() {
if (Serial1.available()) {