Skip to content

Instantly share code, notes, and snippets.

View jscrane's full-sized avatar

Stephen Crane jscrane

View GitHub Profile
@jscrane
jscrane / spwm.ino
Created July 5, 2012 08:05
Software PWM for Arduino/ATtiny
void spwm(int freq, int pin, int spd) {
digitalWrite(pin, HIGH);
delayMicroseconds(spd * freq);
digitalWrite(pin, LOW);
delayMicroseconds(spd * (255 - freq));
}
int delay = 15;
void loop() {
@jscrane
jscrane / .gitignore
Last active February 21, 2016 11:56
Frankenstein's Thermometer, Mark 2
*.bak
@jscrane
jscrane / lcd_lms.pl
Last active September 11, 2016 11:42
Logitech Music Server -> lcdproc
#!/usr/bin/perl -w
use 5.005;
#use strict;
use Getopt::Std;
use IO::Socket;
use IO::Select;
use Fcntl;
use Date::Parse;
use Switch;
@jscrane
jscrane / weather.ino
Last active December 19, 2015 17:19
Arduino sketch for displaying weather.com data
#include <EtherCard.h>
#include <TinyXML.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
#include <petit_fatfs.h>
#include <MemoryFree.h>
#include <stdlib.h>
@jscrane
jscrane / wemo.sh
Last active December 3, 2016 15:19
bash wemo control script
#!/bin/bash
PATH=/usr/local/bin:$PATH
WEMO=wemo
. wemo_functions.sh
case $# in
0)
wemo_get $WEMO
@jscrane
jscrane / fw.c
Last active December 27, 2015 14:49
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <termios.h>
#include <string.h>
#include <unistd.h>
@jscrane
jscrane / .gitignore
Last active February 20, 2019 15:22
TinySensor sketch
.lib
*.cpp.o
tinysensor.ino.bin
tinysensor.ino.elf
tinysensor.eep
@jscrane
jscrane / .gitignore
Last active February 20, 2019 07:46
Sketch to test a TinySensor and commission it by setting its node-id in EEPROM
.lib
*.cpp.o
*.ino.bin
*.ino.elf
*.eep
.*.swp
@jscrane
jscrane / tinyrelay.ino
Created February 20, 2014 13:41
TinyRelay sketch
#include <SoftwareSerial.h>
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
#include <EEPROM.h>
RF24 radio(2, 3);
RF24Network network(radio);
const int rx = 1, tx = 0;
@jscrane
jscrane / prob6041x
Created April 16, 2014 09:57
Probability Cheat Sheet
Counting
------------
**Permutations**
$n! = n(n-1)(n-2) ... 1$
**k-Permutations**
$\frac{n!}{(n-k)!}$
**Combinations**