Skip to content

Instantly share code, notes, and snippets.

View giantmolecules's full-sized avatar
🧐

Brett Ian Balogh giantmolecules

🧐
  • The Laboratory for Artistic Research and Development
  • Chicago
View GitHub Profile
var https = require('https');
var kitchenLightApplianceId = "A146-3456-b31d-7ec4c146c5ea";
var bedroomLightApplianceId = "A146-3456-b31d-7ec4c146c5eb";
var particleServer = "api.particle.io";
var particlePath = "/v1/devices/";
/**
* Main entry point.
* Incoming events from Alexa Lighting APIs are processed via this method.
/*
*
*
*/
PImage sourceImage;
PImage destinationImage;
int sourceDivX = 4;
int sourceDivY = 3;
// This #include statement was automatically added by the Particle IDE.
#include "SparkJson/SparkJson.h"
TCPClient client;
#define DOMAIN "api.openweathermap.org"
char* c="";
char d;
int pastTime = 0;
void setup() {
// put your setup code here, to run once:
pinMode(0, OUTPUT); // PWMA
pinMode(1, OUTPUT); // AI1
pinMode(2, OUTPUT); // AI2
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(1, LOW); // DIR
// This #include statement was automatically added by the Particle IDE.
// One must also include the library in the IDE using the library button on the left
#include <neopixel.h>
#define PIXEL_PIN D0
#define PIXEL_COUNT 1
#define PIXEL_TYPE WS2812B
// These neopixels are GRB, not RGB.
int buttonVal = 0;
// This #include statement was automatically added by the Particle IDE.
// Add the library to your sketch via the IDE, too.
#include <neopixel.h>
#define PIXEL_PIN D0
#define PIXEL_COUNT 1
#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>
#define PIXEL_PIN D0
#define PIXEL_COUNT 1
#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
int lightVal = 0;
//programing 2 range sensors and having info published on computer//
// This #include statement was automatically added by the Particle IDE.//
#include <New_Ping.h>
//Define constrants//
// D0 pin will be used for the LEDs eventualy//
#define TRIGGER_PIN_1 D1
#define ECHO_PIN_1 D1
#define TRIGGER_PIN_2 D2
/*
Smoothing
Reads repeatedly from an analog input, calculating a running average and
printing it to the computer. Keeps ten readings in an array and continually
averages them.
The circuit:
- analog sensor (potentiometer will do) attached to analog input 0
#define STEP 0
#define DIR 1
#define LED 7
void setup() {
pinMode(STEP, OUTPUT);
pinMode(DIR, OUTPUT);
pinMode(LED, OUTPUT);
digitalWrite(DIR, LOW);
}