Skip to content

Instantly share code, notes, and snippets.

View sidwarkd's full-sized avatar
🌮
Smart Puck'in

Kevin Sidwar sidwarkd

🌮
Smart Puck'in
View GitHub Profile
@sidwarkd
sidwarkd / isgovtdown.py
Last active December 24, 2015 14:39 — forked from eduardkoller/isgovtdown.py
Modified to add command line option for running on a Raspberry Pi using GPIO 17 and 18 to control status LEDs. Run from the command line with the argument "pi" to activate status LEDs. Assumes you have already installed the RPi.GPIO library.
#!/usr/bin/env python
#
# file: isgovtdown.py
#
# description: checks usa.gov for the "Government has shut down" message
#
# usage: ./isgovtdown.py [pi]
# Passing argument 'pi' causes status LEDs to be used
#
# or in a crontab:
@sidwarkd
sidwarkd / Observable.cs
Created May 11, 2016 22:12
Observable Class for UWP Data Binding
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 / server.js
Last active December 11, 2016 19:17
Simple Node Server For Onion Omega
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 / christmas_countdown.ino
Created December 17, 2016 05:18
A simple Christmas countdown program for Particle Photon
#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 / particle_temp_sensor.ino
Created December 22, 2016 08:07
A simple temperature sensor that publishes an event to the Particle cloud if it gets above 82 degrees Fahrenheit
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 / app.js
Created January 25, 2017 04:42
Help for Sameer
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 / usbserial1.ino
Created April 19, 2017 03:47
USBSerial1 Example
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 / simple_particle_geolocation.ino
Created May 29, 2017 20:29
Simple Example Using Particle Geolocation Integration
#include "google-maps-device-locator.h"
GoogleMapsDeviceLocator locator;
void setup() {
Serial.begin(9600);
locator.withLocatePeriodic(120);
}
void loop() {
@sidwarkd
sidwarkd / null_string_error.ino
Created May 29, 2017 23:26
Test app from Issue #1322 for Particle Firmware
String x = NULL;
void setup() {}
void loop() {}
@sidwarkd
sidwarkd / compile_errors.ino
Created August 5, 2017 02:28
Particle Dev Missing Compiler Errors
String s = "WTF?"
void setup() {
}
void loop() {
}