This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int RELAY1 = D0; | |
int RELAY2 = D1; | |
int RELAY3 = D2; | |
int MOTION1 = D3; | |
unsigned long lastMotionTime = 0; | |
int propDelay = 10000; // In milliseconds(10 seconds) | |
int propOnTime = 20000; // In milliseconds(20 seconds) | |
int state = 0; // Normal operation = 0, Waiting to actuate prop in 10 seconds = 1, Actuaing props for 20 seconds = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Includes | |
var EventSource = require('eventsource'); | |
var mysql = require('mysql'); | |
// Variables | |
var deviceID = "***FILL THIS IN***"; | |
var accessToken = "***FILL THIS IN***"; | |
// Mysql Connection | |
var connection = mysql.createConnection({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vid = videoinput('winvideo', 1, 'RGB24_320x240'); %select input device | |
hvpc = vision.VideoPlayer; %create video player object | |
src = getselectedsource(vid); | |
vid.FramesPerTrigger =1; | |
vid.TriggerRepeat = Inf; | |
vid.ReturnedColorspace = 'rgb'; | |
src.FrameRate = '30'; | |
start(vid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This #include statement was automatically added by the Spark IDE. | |
#include "OneWire/OneWire.h" | |
// This #include statement was automatically added by the Spark IDE. | |
#include "spark-dallas-temperature/spark-dallas-temperature.h" | |
// Data wire is plugged into port 2 on the Arduino | |
#define ONE_WIRE_BUS D3 | |
#define TEMPERATURE_PRECISION 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma SPARK_NO_PREPROCESSOR | |
// DS18B20 Thermometer Stuff | |
#include "DallasTemperature.h" | |
#include "OneWire/OneWire.h" | |
#define ONE_WIRE_BUS D1 | |
#define TEMPERATURE_PRECISION 9 | |
OneWire oneWire(ONE_WIRE_BUS); | |
DallasTemperature sensors(&oneWire); | |
DeviceAddress inWaterThermometer = { 0x28, 0x2E, 0x54, 0x0A, 0x06, 0x0, 0x0, 0xFB }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package simplejavaserver; | |
import java.net.*; | |
import java.io.*; | |
public class SimpleJavaServer extends Thread | |
{ | |
private ServerSocket serverSocket; | |
public SimpleJavaServer(int port) throws IOException |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "RGBEffect.h" | |
RGBEffect led; | |
// Define a color sequence of 6 colors | |
unsigned int colorSeq[6] = {1,2,3,4,5,6}; // Red, White, Blue, Green | |
void setup() { | |
Spark.function("blinkon", blink); | |
Spark.function("blinkoff", blinkoff); | |
// Define a few colors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
****************************************************************************** | |
* @file application.cpp | |
* @authors Satish Nair, Zachary Crockett and Mohit Bhoite | |
* @version V1.0.0 | |
* @date 05-November-2013 | |
* @brief Tinker application | |
****************************************************************************** | |
Copyright (c) 2013 Spark Labs, Inc. All rights reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original Spark Community Thread: http://community.spark.io/t/how-to-access-the-core-via-we-browser/9711 | |
// Code adapted from: http://arduino.cc/en/Tutorial/WebServer | |
/* Includes ------------------------------------------------------------------*/ | |
#include "application.h" | |
SYSTEM_MODE(AUTOMATIC); | |
TCPServer server = TCPServer(80); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "application.h" | |
char lastTimeRec1[40]; | |
char lastTimeRec2[40]; | |
unsigned long lastTime = 0UL; | |
char publishString[40]; | |
bool whichOne = false; | |
void handleTest1( const char * event, const char * data ); |
OlderNewer