This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Speed up the rotation of LEDs lights or slow down based on button press | |
| */ | |
| #include "blinklib.h" | |
| #include "Serial.h" | |
| ServicePortSerial Serial; | |
| float rotation = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * How to use timers | |
| * | |
| * by Jonathan Bobrow | |
| * 1.25.2018 | |
| */ | |
| #include "blinklib.h" | |
| Timer alarm; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Prototype Step Function | |
| * | |
| * A button press sends step from a single Blink | |
| * All Blinks call their step function | |
| * | |
| * Step is special in that it leaves getNeighborState as the value before step happened... | |
| */ | |
| #include "blinklib.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Test of ready state for Mortals | |
| */ | |
| enum State { | |
| DEAD, | |
| ALIVE, | |
| ENGUARDE, // I am ready to attack! | |
| ATTACKING, // Short window when I have already come across my first victim and started attacking | |
| INJURED, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Example of single fire actions | |
| 07.18.2018 | |
| by Jonathan Bobrow | |
| */ | |
| #include "Serial.h"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Animation Sketch | |
| * Directional flow towards one side of a Blink | |
| * | |
| */ | |
| Timer aniTimer; | |
| #define ANI_DURATION 2000 |