Skip to content

Instantly share code, notes, and snippets.

View SamClayton's full-sized avatar

Sam Clayton SamClayton

  • Seattle, Washington, US
View GitHub Profile
@SamClayton
SamClayton / BasicTest_-_Sam_mod_2_stay_white.ino
Created April 29, 2015 21:02
basic WS2811 string test pattern that runs through some color combos, then continuously sends a full-white (RGB 0xFFFFFF) signal to the chain every second. this is to allow for breaking the data or power connections somewhere on the chain during test pattern run time
/* OctoWS2811 BasicTest.ino - Basic RGB LED Test
http://www.pjrc.com/teensy/td_libs_OctoWS2811.html
Copyright (c) 2013 Paul Stoffregen, PJRC.COM, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@SamClayton
SamClayton / f-stop relative calculator
Last active August 29, 2015 14:16
Calculate relative f-stops for photography
double a = 2;
double b = 16;
/*
println b**2.minus(a**2);
println b**2 - a**2;
double x = a**2;
double y = b**2;
double z = y-x;
double result = z/Math.log(2);
double newresult = ((b/a)**2)/2
@SamClayton
SamClayton / gist:d6463346bb933d915cc7
Created July 24, 2014 07:31
Groovy closures talk examples
def foo(closure) {
println closure.maximumNumberOfParameters
println closure.parameterTypes
}
foo { e -> println e}
foo { int a, double b -> println "$a, $b"}
def greet = { name -> println "${toUpperCase()} $name" }
@SamClayton
SamClayton / shifty_vu_shield_simple_read.ino
Last active August 29, 2015 13:58
Shifty VU shield stripped-down code to echo values to serial monitor, in order to diagnose whether board is working and calibrate scaling potentiometers
/* Read from the Macetech Shifty VU shield and write value to serial
adapted from http://docs.macetech.com/doku.php/rusty_vu
*/
/* Arduino Uno analog pins (from hardware/arduino/variants/standard/pins_arduino.h)
static const uint8_t A0 = 14;
static const uint8_t A1 = 15;
static const uint8_t A2 = 16;
static const uint8_t A3 = 17;
static const uint8_t A4 = 18;
@SamClayton
SamClayton / two_rgb_led_color_wash_fades_fast_opposites.ino
Created April 4, 2014 00:30
Color wash fades with RGB LEDs straight off Arduino analog ports
/*
* RGB_LEDs sketch
* RGB LEDs driven from analog output ports
*/
const int redPin = 3; // choose the pin for each of the LEDs
const int greenPin = 5;
const int bluePin = 6;
const int redPin2 = 11; // choose the pin for each of the LEDs
@SamClayton
SamClayton / shiftbrite_vu_shield.ino
Last active August 29, 2015 13:58
Working on getting the Macetech Shift VU shield working with ShiftBrite pixel
/* From the Rusty VU project http://docs.macetech.com/doku.php/rusty_vu */
#define clockpin 13 // CI
#define enablepin 10 // EI
#define latchpin 9 // LI
#define datapin 11 // DI
#define NumLEDs 1
int LEDChannels[NumLEDs][3] = {0};
@SamClayton
SamClayton / shiftbrite_fades_1.ino
Created April 4, 2014 00:24
Color fades with ShiftBrite and MegaBrite pixels
#define clockpin 13 // CI
#define enablepin 10 // EI
#define latchpin 9 // LI
#define datapin 11 // DI
#define NumLEDs 1
int LEDChannels[NumLEDs][3] = {0};
int SB_CommandMode;
int SB_RedCommand;
@SamClayton
SamClayton / shiftbrite_demo_1.ino
Created April 4, 2014 00:22
Experimenting with ShiftBrite and MegaBrite pixels
#define clockpin 13 // CI
#define enablepin 10 // EI
#define latchpin 9 // LI
#define datapin 11 // DI
#define NumLEDs 1
int LEDChannels[NumLEDs][3] = {0};
int SB_CommandMode;
int SB_RedCommand;
@SamClayton
SamClayton / EL_seq_test_1.ino
Created April 4, 2014 00:14
Test sketch for El Escudo Dos by SparkFun
// Test sketch for El Escudo Dos
// Turn each EL channel (A-H) on in sequence and repeat
// Mike Grusin, SparkFun Electronics
void setup() {
// The EL channels are on pins 2 through 9
// Initialize the pins as outputs
pinMode(2, OUTPUT); // channel A
pinMode(3, OUTPUT); // channel B
pinMode(4, OUTPUT); // channel C