Skip to content

Instantly share code, notes, and snippets.

View dmiddlecamp's full-sized avatar

David Middlecamp dmiddlecamp

View GitHub Profile
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(MANUAL);
#define DISCONNECT_EVERY 5000
unsigned int lastConnect;
bool connectionState = false;
bool state = false;

Keybase proof

I hereby claim:

  • I am dmiddlecamp on github.
  • I am middleca (https://keybase.io/middleca) on keybase.
  • I have a public key whose fingerprint is A9BD 4348 3627 BB4D F5EB 7C37 8781 FF60 3FC6 3B42

To claim this, I am signing this object:

@dmiddlecamp
dmiddlecamp / macAddress.ino
Last active August 29, 2016 21:37
mac address example
byte mac[6];
void setup() {
WiFi.macAddress(mac);
String macAddress;
for (int i=0; i<6; i++) {
if (i) {
macAddress += ":";
}
macAddress += String(mac[i], HEX);
class MyLed
{
Timer* timer;
public:
MyLed()
{
timer = new Timer(1000, &MyLed::timeout, *this);
timer->start();
}
#include "InternetButton/InternetButton.h"
#include "math.h"
/*Did you know that the SparkButton can detect if it's moving? It's true!
Specifically it can read when it's being accelerated. Recall that gravity
is a constant acceleration and this becomes very useful- you know the orientation!*/
#define AVG_COUNT 50.0
#define ARR_SIZE 50
int idx = 0;
Hi @west, do you have a new Electron or a Beta Unit?
If Beta, give this thread a read for how to upgrade ahead of time: https://community.particle.io/t/solved-unable-to-setup-particle-electron/19919/12
If new, it will be nice to see what's happening on your unit to debug it more easily. To do this you may download a version of Tinker that has USB serial debugging enabled:
https://github.com/spark/firmware/releases/download/v0.4.8-rc.6/tinker-usb-debugging-v0.4.8-rc.6-electron.bin
You can then flash this to your electron with the [**Particle CLI**][1] with your electron in [**DFU mode**][2]:
``
particle flash --usb tinker-usb-debugging-v0.4.8-rc.6-electron.bin
#include "AFNetworking.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Keys" "${PODS_ROOT}/Headers/Public/Spark-SDK" "${PODS_ROOT}/Headers/Public/SparkSetup"
OTHER_LDFLAGS = ${AFNETWORKING_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
@dmiddlecamp
dmiddlecamp / Keys-Private.xcconfig
Created December 15, 2015 18:08
Target Support Files
#include "Keys.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Keys" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Keys" "${PODS_ROOT}/Headers/Public/Spark-SDK" "${PODS_ROOT}/Headers/Public/SparkSetup"
OTHER_LDFLAGS = ${KEYS_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
// This #include statement was automatically added by the Particle IDE.
#include "neopixel/neopixel.h"
#include "math.h"
SYSTEM_MODE(MANUAL);
#define RANDOM_SPIRITS true
#define RANDOM_SPIRIT_CHANCE 0.10
#define DEFAULT_BRIGHTNESS 1
#define NUM_PIXELS 8
float pixels[NUM_PIXELS];
#define KERNEL_SIZE 5
float kernel[KERNEL_SIZE] = { 1, 0.8, 0.4, 0.8, 1 };
int kernelPos = -1 * KERNEL_SIZE;