This file contains hidden or 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
| // The most basic event, without data. | |
| Spark.publish("motion-detected"); | |
| // Some events require additional data. | |
| Spark.publish("temperature", "19 F"); | |
| // You can set a TTL to persist data in the cloud... | |
| Spark.publish("lake-depth/1", "28", 21600); | |
| // ...and make events private for secure applications. |
This file contains hidden or 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
| test |
This file contains hidden or 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 motion = 0; | |
| int buzzer = 1; | |
| void setup() { | |
| pinMode(motion, INPUT); | |
| pinMode(buzzer, OUTPUT); | |
| Spark.variable(motion); | |
| Spark.function(buzz); | |
| } |
This file contains hidden or 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 spark_wiring_servo.h | |
| * @author Zach Supalla | |
| * @version V1.0.0 | |
| * @date 06-December-2013 | |
| * @brief Header for spark_wiring_servo.h module | |
| ****************************************************************************** | |
| Copyright (c) 2013 Spark Labs, Inc. All rights reserved. | |
| Copyright (c) 2010 LeafLabs, LLC. |
This file contains hidden or 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
| TCPClient client; | |
| void setup() { | |
| Serial.begin(9600); | |
| Spark.function("connect", connect_to_my_server); | |
| for (int pin = D0; pin <= D7; ++pin) { | |
| pinMode(pin, OUTPUT); | |
| } |
This file contains hidden or 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
| TCPClient client; | |
| void setup() { | |
| Serial.begin(9600); | |
| Spark.function("connect", connect_to_my_server); | |
| for (int pin = D0; pin <= D7; ++pin) { | |
| pinMode(pin, OUTPUT); | |
| } |
This file contains hidden or 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
| TCPClient client; | |
| void setup() { | |
| Serial.begin(9600); | |
| Spark.function("connect", connect_to_my_server); | |
| for (int pin = D0; pin <= D7; ++pin) { | |
| pinMode(pin, OUTPUT); | |
| } |
This file contains hidden or 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
| /* | |
| * Connected sensor | |
| * Spark.publish() + PIR motion sensor = awesome | |
| * Thanks to Adafruit for the reference and inspiration | |
| */ | |
| int inputPin = D0; // choose the input pin (for PIR sensor) | |
| int pirState = LOW; // we start, assuming no motion detected | |
| int val = 0; // variable for reading the pin status | |
| int calibrateTime = 10000; // wait for the thingy to calibrate |
This file contains hidden or 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
| /** | |
| * Slay and pillage an unprotected network! ...oh, we can't do that? | |
| * Ok, let's publish an event instead, to a backdrop of flashing lights and | |
| * clashing of metal on metal. | |
| */ | |
| void vanquishOpenNetwork() { | |
| if (!openNetworkCount || !strongest.rssi) | |
| return; | |
| RGB.control(false); // allow the system to control the LED so we can see cloud connection progress | |
| makeSound(); |
This file contains hidden or 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
| npm install serialport | |
| - | |
| > serialport@1.5.0 install /Users/zsupalla/Dropbox (Spark)/Software/Code/spark-cli/node_modules/serialport | |
| > node-pre-gyp install --fallback-to-build | |
| child_process: customFds option is deprecated, use stdio instead. | |
| CXX(target) Release/obj.target/serialport/src/serialport.o | |
| CXX(target) Release/obj.target/serialport/src/serialport_unix.o | |
| ../src/serialport_unix.cpp:663:20: warning: comparison of array 'device.locationId' not equal to a null pointer is always true [-Wtautological-pointer-compare] | |
| if (device.locationId != NULL) { |
OlderNewer