Skip to content

Instantly share code, notes, and snippets.

@cmsunu28
cmsunu28 / Photoresistor-Variable.ino
Created May 7, 2015 16:14
Photoresistors Part One: Spark Variable and Spark Function
/*---OH HI THERE, WELCOME TO THE PHOTORESISTOR PROGRAM---
Part One: Spark Variable and Spark Function
We've heavily commented this code for you. If you're a pro, feel free to ignore it.
Comments start with two slashes or are blocked off by a slash and a star.
You can read them, but your device can't.
It's like a secret message just for you.
Servo myservo;
int pos = 0;
int holdpos = 90;
int recoilpos = 90;
int hitpos = 180;
int servodelay = 200;
void go(const char *event, const char *data) {
@cmsunu28
cmsunu28 / repulsor.ino
Last active August 29, 2015 14:20
Repulsor
// This #include statement was automatically added by the Spark IDE.
#include "SparkButton/SparkButton.h"
SparkButton b = SparkButton();
// set a bunch of default values for variables we will use later
int lastY=31;
int lastlit=1;
int xValue;
int yValue;
// This #include statement was automatically added by the Spark IDE.
#include "SparkButton/SparkButton.h"
#include "math.h"
SparkButton b = SparkButton();
int state=0; // sets state of the reactor
// 0: breathing quietly
// 1: received notice of repulsor firing
@cmsunu28
cmsunu28 / weatherlight.js
Last active August 29, 2015 14:07
An LED that turns on when it's going to rain
/*jslint node: true */
"use strict";
var request = require("request");
var spark = require("spark");
//change this URL to reflect your own city.
var url = 'http://api.openweathermap.org/data/2.5/forecast/daily?q=San%20Francisco,CA&cnt=1&mode=json';
@cmsunu28
cmsunu28 / blink.js
Created September 30, 2014 23:45
Blink an LED with Javascript!