Skip to content

Instantly share code, notes, and snippets.

🌮
Smart Puck'in

Kevin Sidwar sidwarkd

🌮
Smart Puck'in
Block or report user

Report or block sidwarkd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sidwarkd
sidwarkd / usbserial1.ino
Created Apr 19, 2017
USBSerial1 Example
View usbserial1.ino
void setup() {
delay(5000); // Give yourself 5 seconds to launch particle serial monitor
Serial.begin();
USBSerial1.begin();
Serial.println("Serial port configured!");
USBSerial1.println("USBSerial1 configured too!");
pinMode(D7, OUTPUT);
}
void loop() {
@sidwarkd
sidwarkd / app.js
Created Jan 25, 2017
Help for Sameer
View app.js
var config = require("./config.js");
var socket = require("socket.io-client")(config.server_url);
var gpio = require("rpi-gpio");
var sensorLib = require('node-dht-sensor');
var data=0;
process.on("SIGINT", function(){
gpio.write(config.led, 1, function(){
gpio.destroy(function(){
@sidwarkd
sidwarkd / particle_temp_sensor.ino
Created Dec 22, 2016
A simple temperature sensor that publishes an event to the Particle cloud if it gets above 82 degrees Fahrenheit
View particle_temp_sensor.ino
void setup() {
Serial.begin(9600);
}
void loop() {
int val = analogRead(A0);
float voltage = val * 3.3 / 4096; // Convert analog reading to voltage value
float tempC = (voltage - 0.5) * 100;
float tempF = (tempC * 9.0 / 5.0) + 32.0;
Serial.printlnf("Temp F: %3.1f Temp C: %3.1f", tempF, tempC);
@sidwarkd
sidwarkd / christmas_countdown.ino
Created Dec 17, 2016
A simple Christmas countdown program for Particle Photon
View christmas_countdown.ino
#include <time.h>
#define TARGET_MONTH 12
#define TARGET_DAY 25
#define TARGET_YEAR 2016
#define CLEAR_COMMAND 0x76
#define CURSOR_COMMAND 0x79
struct tm target = {0};
@sidwarkd
sidwarkd / twilio.json
Created Dec 10, 2016
Particle Webhook Config File Template for Twilio Integration
View twilio.json
{
"eventName": "[EVENT TO LISTEN FOR]",
"url": "https://api.twilio.com/2010-04-01/Accounts/[ACCOUNT SID]/Messages",
"requestType": "POST",
"auth": {
"username": "[ACCOUNT SID]",
"password": "[AUTH TOKEN]"
},
"form": {
"From" : "[YOUR TWILIO NUMBER]",
@sidwarkd
sidwarkd / fridgeye_nextion.ino
Created Dec 1, 2016
Arduino Sketch for Fridgeye App on Nextion Display
View fridgeye_nextion.ino
// Include the Nextion Arduino library
#include "Nextion.h"
long lastUpdate;
int SENSOR = A0; // Alias A0 as SENSOR
// t0 element from the Nextion GUI Editor was on
// page 0 with an id of 2.
NexText t0 = NexText(0, 2, "t0");
@sidwarkd
sidwarkd / server.js
Last active Dec 11, 2016
Simple Node Server For Onion Omega
View server.js
const http = require('http');
const hostname = '0.0.0.0';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello from the Onion Omega\n');
});
@sidwarkd
sidwarkd / Observable.cs
Created May 11, 2016
Observable Class for UWP Data Binding
View Observable.cs
public class Observable : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void Changed([CallerMemberName]string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
@sidwarkd
sidwarkd / config.json.sample
Created Apr 1, 2015
Competitor to the Amazon Dash
View config.json.sample
{
"sparkAccessToken": "",
"sparkDeviceID": "",
"twilioAccountSID": "",
"twilioAuthToken": "",
"toPhoneNumber": "[NUMBER TO CALL]",
"fromPhoneNumber": "[YOUR TWILIO NUMBER]",
"paperTowelTwiml": "[URL TO TWIML FILE. DROPBOX WORKS GREAT]"
}
@sidwarkd
sidwarkd / example.cs
Created Mar 16, 2015
A super simple way to get the list of project files from a Visual Studio Solution file.
View example.cs
public static void GetProjectFilesFromSolution(string solutionFile)
{
if (File.Exists(solutionFile))
{
string cwd = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(solutionFile));
// This is a hack for reading solution files but is better than the almost 100 lines of code
// necessary to load a special MS assembly and parse the file the 'right way'
string[] solutionContents = File.ReadAllLines(solutionFile);
You can’t perform that action at this time.