Skip to content

Instantly share code, notes, and snippets.

View jonmarkgo's full-sized avatar
🎓
preparing the MLH Fellowship

Jonathan Gottfried jonmarkgo

🎓
preparing the MLH Fellowship
View GitHub Profile
@jonmarkgo
jonmarkgo / gist:3289035
Created August 7, 2012 20:31
poweroutletsketch
#include <WiFlyHQ.h>
#include <SoftwareSerial.h>
#include <PusherClient.h>
const char mySSID[] = "my$ssid"; //use $ to represent spaces in your ssid or passphrase
const char myPassword[] = "my$pass$phrase";
const char pusherKey[] = "abc123";
PusherClient client;
@jonmarkgo
jonmarkgo / gist:3289015
Created August 7, 2012 20:26
poweroutlet4
//paste powerSwitch function here
void powerSwitch(String data) {
String cmd = client.parseMessageMember("command", data);
wifiSerial.print("Command: ");
wifiSerial.println(cmd);
if (cmd == "on") {
digitalWrite(poweroutlet,HIGH);
}
else {
@jonmarkgo
jonmarkgo / gist:3289009
Created August 7, 2012 20:25
poweroutlet3
//paste loop function here
void loop() {
if (client.connected()) {
digitalWrite(led,HIGH);
client.monitor();
}
}
//paste powerSwitch function here
@jonmarkgo
jonmarkgo / gist:3289002
Created August 7, 2012 20:23
poweroutlet2
//paste next block of code here
if (!wifly.isAssociated()) { //check to see if we are already associated with the network before connecting
wifiSerial.println(F("Joining network"));
if (wifly.join(mySSID, myPassword, true)) { //using the true flag at the end of wifly.join indicates that we are using WPA
wifly.save();
wifiSerial.println(F("Joined wifi network"));
}
else {
wifiSerial.println(F("Failed to join wifi network"));
wifly.terminal();
@jonmarkgo
jonmarkgo / gist:3288968
Created August 7, 2012 20:14
poweroutlet1
#include <WiFlyHQ.h>
#include <SoftwareSerial.h>
#include <PusherClient.h>
const char mySSID[] = "my$ssid"; //use $ to represent spaces in your ssid or passphrase
const char myPassword[] = "my$pass$phrase";
const char pusherKey[] = "abc123";
PusherClient client;
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#searchbutton").click(function () {
// Build OData query
var movieName = $("#search").val();
#include <EEPROM.h>
#include "EEPROMAnything.h"
struct User
{
char * phonenumber;
} user;
User authUsers[3];
User defUsers[3];
void setup()
#include <WiFlyHQ.h>
#include <SD.h>
#include <PusherClient.h>
PusherClient client;
WiFly wifly;
File permFile;
void setup() {
/*
* WiFlyHQ Example WebSocketClient.ino
*
* This sketch implements a simple websocket client that connects to a
* websocket echo server, sends a message, and receives the response.
* Accepts a line of text via the wifiSerial monitor, sends it to the websocket
* echo server, and receives the echo response.
* See http://www.websocket.org for more information.
*
* This sketch is released to the public domain.
@jonmarkgo
jonmarkgo / cof.php
Created June 23, 2012 20:05 — forked from jaboutboul/cof.php
Cost of Freedom Text Based App
<?php
header('Content-type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$message = strip_tags($_REQUEST['Body']);
$response = "Welcome to the Cost of Freedom. Please text your state abbreviation to get Voter ID requirements and info.";
//our spreadsheet's key
$key = "0Aoz1Ir-h-0g5dG00N1lDVG1COTFHellrc2o2bDhoeXc";
//the public url