Skip to content

Instantly share code, notes, and snippets.

wgbartley / proxy.php
Last active Dec 18, 2017
Spark PHP Proxy
View proxy.php
// Set your access token here
define('ACCESS_TOKEN', 'your_access_token_here');
// Make sure we have an HTTP_ACCEPT header,
// and if so, make it lower-case for easier string matching
wgbartley / DHT.cpp
Created Apr 26, 2014
Spark Sensor Madness with Classes
View DHT.cpp
#include "DHT.h"
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
_pin = pin;
_type = type;
_count = count;
firstreading = true;
wgbartley / elapsedMillis.h
Created Apr 24, 2014
Simple Spark Core firmware for reading temperature from TMP36 and light from an LDR
View elapsedMillis.h
/* Elapsed time types - for easy-to-use measurements of elapsed time
* Copyright (c) 2011 PJRC.COM, LLC
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
wgbartley / DHT22.cpp
Last active Aug 29, 2015
Less Blocking DHT22 Library for Spark Core
View DHT22.cpp
#include "DHT22.h"
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
_pin = pin;
_type = type;
_count = count;
firstreading = true;
_next_read_millis = 0;
_next_read_step = 1;
wgbartley / doorbell2SMS.cpp
Last active Aug 29, 2015
View doorbell2SMS.cpp
* This is a simple "sketch" that calls a web page when a button is pressed. It is a proof-of-concept
* for my boss and hastily written in about 2 hours. The remote URL is a PHP script that handles
* making the API calls to a remote SMS-messaging service.
* I'm sure it could make use of interrupts somehow, but I'm not sure how off the top of my head.
* It uses the onboard RGB LED as status display:
* - Red = Waiting to be pressed
* - Green = Making HTTP request
wgbartley / smartDingDong.cpp
Created Mar 7, 2014
A simple sketch for detecting a button press (for example, a doorbell) that calls a web page to send a text message. The onboard RGB LED will be red when nothing is happening. It turns green as it makes the web request, and then turns blue for 1 second after the request.
View smartDingDong.cpp
int ddl = 0; // Ding dong last millis()
int btnpin = D0; // "Button" pin
const int ddd = 15000; // Time until button can be activated again
void setup() {
pinMode(btnpin, INPUT_PULLUP);
wgbartley / Configuration.h
Last active Dec 5, 2015
Configuration.h for my Prusa i3
View Configuration.h
// This configuration file contains the basic settings.
// Advanced settings can be found in Configuration_adv.h
// BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
//============================= DELTA Printer ===============================
wgbartley / Spark-DS18B20.pde
Last active Jan 2, 2016
Class to read temperature from DS18B20 sensor attached to a Spark Core
View Spark-DS18B20.pde
#ifndef OneWire_h
#define OneWire_h
#include <inttypes.h>
// you can exclude onewire_search by defining that to 0
// You can exclude CRC checks altogether by defining this to 0
wgbartley / Spark-DHT22.pde
Last active Nov 20, 2016
Class for reading DHT22 values on a Spark Core
View Spark-DHT22.pde
#define MAXTIMINGS 85
#define cli noInterrupts
#define sei interrupts
#define DHT11 11
#define DHT22 22
#define DHT21 21
#define AM2301 21
wgbartley / Spark-Thermistor.pde
Last active Jan 2, 2016
Basic class for reading thermistor values on a Spark Core
View Spark-Thermistor.pde
#include <math.h>
class Thermistor {
int _pin;
int _resistor;
int _temp_raw;
float _temp_k;
float _temp_c;
float _temp_f;
You can’t perform that action at this time.