Skip to content

Instantly share code, notes, and snippets.

View dmiddlecamp's full-sized avatar

David Middlecamp dmiddlecamp

View GitHub Profile
//SYSTEM_MODE(MANUAL);
// This #include statement was automatically added by the Spark IDE.
#include "SparkButton/SparkButton.h"
#include "math.h"
#define BASE_NON_CHEER_INTENSITY 64
#define CHEER_DURATION 25.0
//bool state = false;
#include "application.h"
#include "ctrl.h"
Ctrl::Ctrl()
{
init();
}
Ctrl::~Ctrl(){
}
#define MICROPHONE_PIN A5
#define AUDIO_BUFFER_MAX 8192
int audioStartIdx = 0, audioEndIdx = 0;
uint16_t audioBuffer[AUDIO_BUFFER_MAX];
uint16_t txBuffer[AUDIO_BUFFER_MAX];
// version without timers
unsigned long lastRead = micros();
@dmiddlecamp
dmiddlecamp / main.ino
Created July 18, 2015 19:54
Photon Audio Example
#define MICROPHONE_PIN A5
#define AUDIO_BUFFER_MAX 8192
int audioStartIdx = 0, audioEndIdx = 0;
uint16_t audioBuffer[AUDIO_BUFFER_MAX];
uint16_t txBuffer[AUDIO_BUFFER_MAX];
// version without timers
unsigned long lastRead = micros();
@dmiddlecamp
dmiddlecamp / coco-button.ino
Created June 12, 2015 16:06
Available / Busy / Away button for Mikky
// This #include statement was automatically added by the Spark IDE.
#include "HttpClient/HttpClient.h"
// This #include statement was automatically added by the Spark IDE.
#include "SparkButton/SparkButton.h"
#define START_COLOR 25,25,25
#define BTN1_COLOR 200,0,0
#define BTN2_COLOR 0,200,0
#define BTN3_COLOR 75,50,200
@dmiddlecamp
dmiddlecamp / neopixel.cpp
Created May 26, 2015 15:27
updated neopixel library for the photon
/*-------------------------------------------------------------------------
Spark Core library to control WS2811/WS2812 based RGB
LED devices such as Adafruit NeoPixel strips.
Currently handles 800 KHz and 400kHz bitstream on Spark Core,
WS2812, WS2812B and WS2811.
Also supports:
- Radio Shack Tri-Color Strip with TM1803 controller 400kHz bitstream.
- TM1829 pixels
@dmiddlecamp
dmiddlecamp / temp_demo.ino
Last active November 23, 2016 18:57
all in one temperature demo
#include "application.h"
#define NUM_SENSORS 1
#ifndef OneWire_h
#define OneWire_h
#include <inttypes.h>
// you can exclude onewire_search by defining that to 0
#ifndef ONEWIRE_SEARCH
@dmiddlecamp
dmiddlecamp / publish_demo.ino
Created February 12, 2015 15:38
a working demo of public/private publish / subscribe for multiple cores
#define publish_delay 10000
#define PUBLISH_TO "some_private_event_1"
#define PUBLIC_EVENT "some_public_event_1"
unsigned int lastPublish = 0;
void setup() {
Serial.begin(115200);
//the firmware uses the event name to figure out which handler it should toss things to, and doesn't select based on privacy, so we need to also make the event names differ in this example.
@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()) {
@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() {