Skip to content

Instantly share code, notes, and snippets.

View dmiddlecamp's full-sized avatar

David Middlecamp dmiddlecamp

View GitHub Profile
@dmiddlecamp
dmiddlecamp / emailDemo.cpp
Created February 11, 2014 20:04
A pretty rough example for sending an emil!
#define SMTP_SERVER "smtp.yourserver.com"
#define SMTP_USER_BASE64 "base64_encode_your_user"
#define SMTP_PASS_BASE64 "base64_encode_your_pass"
#define SMTP_FROM_EMAIL "email@from.com"
#define SMTP_TO_EMAIL "email@to.com"
#define SMTP_SUBJECT "Email from a Core!"
#define SMTP_BODY "Body body body"
#include "application.h"
@dmiddlecamp
dmiddlecamp / TempSensor.h
Created April 23, 2014 17:18
OneWire Temp - Multiple Sensors
#include "application.h"
class TempSensor {
public:
char *id ;
uint8_t rom[8];
float value ;
int updated ;
};
@dmiddlecamp
dmiddlecamp / WifiScan.cpp
Created April 25, 2014 15:46
WifiScanner example firmware for the core
#include "WifiScan.h"
#include "application.h"
void parseScanResultToJson(WifiScanResults_t result, char *line);
void bytesToHex(unsigned char *data, int length, char* buffer);
void wipeStr(char *str, int len) {
for(int i = 0; i < len ;i++) {
str[i] = 0;
}
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Collections.Generic;
public class SSEvent {
public string Name { get; set; }
public string Data { get; set; }
void setup() {
initWifi();
}
void loop() {
}
void initWifi() {
#include "HttpClient.h"
#define LOGGING
#define TIMEOUT 5000 // Allow maximum 5s between data packets.
/**
* Constructor.
*/
HttpClient::HttpClient()
{
@dmiddlecamp
dmiddlecamp / battery_counter.ino
Created July 11, 2014 15:45
turn a spark core cc3000 on/off every 45 seconds, give or take
#include "application.h"
#include "spark_disable_wlan.h"
#include "spark_disable_cloud.h"
int state = 0;
int awake = 0;
unsigned int lastWakeup = 0;
//wakeup once a minute
unsigned int wakeupDelay = 60 * 1000;
@dmiddlecamp
dmiddlecamp / packetClient.js
Last active August 29, 2015 14:04
CC3000 failing reads at 256 byte boundaries
/**
* Created by middleca on 7/17/14.
*/
var when = require('when');
var settings = {
ip: "192.168.1.49",
port: 80,
start_size: 0,
end_size: 1024
/*
* Bitcoin Price Index JSON Parsing TCP Client Example
* BDub @ Technobly.com 6/27/2014
* LICENSE: MIT (C) 2014 BDub
*
*/
#pragma SPARK_NO_PREPROCESSOR
#include "application.h"
@dmiddlecamp
dmiddlecamp / Adafruit_GPS.cpp
Last active April 21, 2018 05:07
Spark GPS demo with Adafruit Ultimate GPS breakout
/***********************************
This is our GPS library
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, check license.txt for more information
All text above must be included in any redistribution