Skip to content

Instantly share code, notes, and snippets.

@jbobrow
jbobrow / SerialReporter.ino
Created April 19, 2019 01:04
A sort of Blinks stethoscope
/*
Serial Reporter
---------------
A utility app designed to make debugging of games
that are buggy in transmitting game state. Essentially,
this blink is a stethoscope for Blinks.
The Serial Reporter will:
1. Look for values received on all faces
2. Print values when received on faces
@jbobrow
jbobrow / Long Press validation
Created March 1, 2019 21:30
Test the long press validation with action on release
/*
* Button Long Press and confirm on release
*/
bool hasBeenLongPressed = false;
bool bFastPulse = false;
byte bri[6];
void setup() {
@jbobrow
jbobrow / WakeSleepProgram.ino
Created December 17, 2018 07:04
not a code reference, just an animation reference
/*
Wake, Sleep, Program
Wake - simple spiral before loading game state
Sleep - simple spiral in reverse before going dark
Program - flash with urgency
*/
uint32_t timeOfPress;
#define SYNC_PAUSE_DURATION 200
byte urge = 0;
byte brightness = 0;
Timer faceTimer[6];
Timer sendTimer;
void setup() {
@jbobrow
jbobrow / FlowToFace.ino
Created November 12, 2018 23:57
Blink animation for flowing one direction into another Blink
/*
* Animation Sketch
* Directional flow towards one side of a Blink
*
*/
Timer aniTimer;
#define ANI_DURATION 2000
@jbobrow
jbobrow / Whackamole_Main_Menu.ino
Created November 8, 2018 05:43
A start for the kind of "attract screen" that whackamole should have...
/*
Mole waiting animation
*/
uint32_t pixelSetTime[6];
uint32_t timeOfPlayerSelection;
Timer popUpTimer;
// number of players
byte numPlayers = 1;
@jbobrow
jbobrow / SingleFireActions.ino
Created July 18, 2018 21:49
Blinks - Single Fire Action Example
/*
Example of single fire actions
07.18.2018
by Jonathan Bobrow
*/
#include "Serial.h";
/*
* RadioLab coin flip
*
* Shows empirically that flipping 100 times and seeing a
* streak of 7 is much more likely than stated in the Stochacity episode
*
* In the show, they mention 14 sets of 7, which is 98 coin flips, with distinct sets
* This is very different than a continuous 100 flips, and much closer to their stated
* 1/6 chance of seeing a perfect run of 7
*/
/*
* RadioLab coin flip
*
* Shows empirically that flipping 100 times and seeing a
* streak of 7 is much more likely than stated in the Stochacity episode
*/
int numberOfTrials = 0; // number of trials (does what it says :)
int numberOfFlipsInTrial = 100; // number of flips in a trial... yeah aptly named
int lengthOfStreak = 7; // how many Tails in a row to make a streak
/*
* Take on the color of the dominant Blink attached
*/
byte myState = 0;
Color colors[] = {OFF, BLUE, RED, YELLOW, ORANGE, GREEN};
void setup() {
// put your setup code here, to run once:
setValueSentOnAllFaces( myState );