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
// HTTP | |
function requestHandler(request,response) { | |
try { | |
server.log(http.jsonencode(request.query)); | |
if ("led" in request.query) { | |
device.send("set.led",request.query.led); | |
} | |
response.send(200,"OK"); | |
} catch (err) { | |
response.send(500,"ERROR: "+err); |
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
// turn the LED a color | |
#require "WS2812.class.nut:3.0.0" | |
local spi = hardware.spi257; | |
spi.configure(MSB_FIRST,7500); | |
hardware.pin1.configure(DIGITAL_OUT,1); | |
local led = WS2812(spi,1); | |
function setRGB(colorcode) { | |
local rgb = split(colorcode,","); | |
led.set(0,[rgb[0].tointeger(),rgb[1].tointeger(),rgb[2].tointeger()]); | |
led.draw(); |
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
// copy and paste this whole thing into the console | |
// kludgy, but gets the job done | |
// works on chrome | |
// step 1: inject code at https://player.vimeo.com/api/player.js | |
// (if you had access, you would just add <script> tag to this) | |
/*! @vimeo/player v2.10.0 | (c) 2019 Vimeo | MIT License | https://github.com/vimeo/player.js */ | |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e=e||self).Vimeo=e.Vimeo||{},e.Vimeo.Player=t())}(this,function(){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var e="undefined"!=typeof global&&"[object global]"==={}.toString.call(global);function i(e,t){return 0===e.indexOf(t.toLowerCase())?e:"".concat(t.toLowerCase()).concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}function s(e){return/^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(e)}function l() |
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
module['exports'] = function echoHttp (hook) { | |
var https = require('https'); | |
var querystring = require('querystring'); | |
var env = hook.env; | |
var token = env.particle_access_token; | |
var deviceID = env.particle_doorbell_device_id; | |
// don't forget to define these secret variables at hook.io/env | |
var request = require('request'); | |
var nickname = hook.params["name"]; |
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
#define MIC_PIN A0 // Microphone is attached to this analog pin | |
#define DC_OFFSET 0 // DC offset in mic signal - if unusure, leave 0 | |
#define NOISE 10 // Noise/hum/interference in mic signal | |
#define SAMPLES 60 // Length of buffer for dynamic level adjustment | |
#define VIB_PIN A7 | |
#define SIGNAL_PIN D7 | |
// time values |
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
date | close | |
---|---|---|
0:0:0 | 1 | |
0:0:1 | 0 | |
0:0:2 | 0 | |
0:0:3 | 1 | |
0:0:4 | 1 | |
0:0:5 | 1 | |
0:0:6 | 1 | |
0:0:7 | 1 | |
0:0:8 | 1 |
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
// This #include statement was automatically added by the Particle IDE. | |
#include "InternetButton/InternetButton.h" | |
#include "math.h" | |
// SYSTEM_MODE(SEMI_AUTOMATIC); | |
long startTime2 = 0; | |
int alreadyDown2 = 0; |
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
/*---OH HI THERE, WELCOME TO THE PHOTORESISTOR PROGRAM--- | |
Part Three-- Publish and Subscribe with your Photoresistor and a Buddy | |
We will assume here that you've already done part one. | |
Now for Part Two-- the part where you get a buddy. | |
Go find a buddy who also has a Spark device. | |
Each of you will pick a unique event name | |
(make it weird so that no one else will have it) |
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
/*---OH HI THERE, WELCOME TO THE PHOTORESISTOR PROGRAM--- | |
Part Two: Sensing motion with your photoresistor | |
We're going to assume that you've already checked out Part One! | |
This app will make it so that you know when the beam of light | |
between the LED and the photoresistor is broken. | |
It essentially makes a little tripwire sensor out of your LED and photoresistor. |
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
<!-- Replace your-device-ID-goes-here with your actual device ID | |
and replace your-access-token-goes-here with your actual access token--> | |
<center> | |
<br> | |
<br> | |
<br> | |
<form action="https://api.spark.io/v1/devices/your-device-ID-goes-here/led?access_token=your-access-token-goes-here" method="POST"> | |
Tell your device what to do!<br> | |
<br> |
NewerOlder