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
| //system variables | |
| #define MAX_NOTES_PER_PATTERN 32 | |
| #define MAX_PATTERNS 4 | |
| //"enums" | |
| #define MIDI_NOTEON 0x90 | |
| #define MIDI_NOTEOFF 0x80 | |
| #define NOTE_PITCH 0 | |
| #define NOTE_VELOCITY 1 | |
| #define NOTE_LENGTH 2 |
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
| //NRPN | |
| void midiNRPN(uint16_t MSB_, uint16_t LSB_, uint16_t value_) { | |
| MIDI.sendControlChange(99,MSB_, 1); | |
| MIDI.sendControlChange(98,LSB_, 1); | |
| MIDI.sendControlChange(6,value_, 1); | |
| } | |
| midiNRPN(0, 35, x); | |
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
| Getting the SSD1306 OLED Display to work on the ESP8266 via D1 Mini. | |
| First, open your arduino IDE, and go to preferences. | |
| In the "Additional Boards Manager URLs" field, enter "http://arduino.esp8266.com/stable/package_esp8266com_index.json" | |
| press "okay" | |
| Now go to to "Tools->Board->Boards Manager" | |
| Find "esp8266" by "ESP8266 Community", and install it. This installs the toolchain and libraries needed. | |
| Now under "Board", select your esp8266 board, in this case, the d1 mini. |
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
| /********************************************************************* | |
| This is an example for our Monochrome OLEDs based on SSD1306 drivers | |
| Pick one up today in the adafruit shop! | |
| ------> http://www.adafruit.com/category/63_98 | |
| This example is for a 128x64 size display using I2C to communicate | |
| 3 pins are required to interface (2 I2C and one reset) | |
| Adafruit invests time and resources providing this open source code, |
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
| Getting an SSD1306 i2c LCD display to work on an arduino UNO. | |
| First, you need to hook up the 4-pin lcd device up to your arduino: | |
| GND goes to GND | |
| VDD goes to 5V | |
| SCK goes to A5 | |
| SDA goes to A4 | |
| Next, identify the i2c device address of your lcd panel. Run the following sketch with the serial monitor open, and note the 8bit address that it returns: |
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
| class Pot { | |
| uint16_t currentDeepValue = 0; | |
| uint16_t lastDeepValue = 0; | |
| uint8_t pin = 0; //this is also the ID | |
| uint16_t potResolution = 0; | |
| public: | |
| Pot(uint8_t pin_, uint16_t potResolution_) { | |
| pin = pin_; |
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
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| "net/http" | |
| "strconv" | |
| "regexp" | |
| "github.com/PuerkitoBio/goquery" | |
| ) |
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
| #include "noise.h" | |
| float generateNoise(float x, float y, int salt) { | |
| x = fabs(x);//this function cannot handle negative coordinates, so fabs (floating abs) is required. | |
| y = fabs(y);//The side effect is that everything is mirrored on the x/y axis :( | |
| //generate x/y coords for each anchor point around the real point | |
| int x1 = (int) floor(x); | |
| int x2 = (int) floor(x) + 1; | |
| int y1 = (int) floor(y); |
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
| /*Deep search tic tac toe ai console game | |
| written may 2016 by Jeremy Clark */ | |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "os/exec" | |
| ) |
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
| --call with self.cells = self:generateCellsFromDNA(DNAString, {{x=0, y=0}}) | |
| function Creature:generateCellsFromDNA(DNAStrand, cellPool) | |
| function cellPoolContains(x_, y_, cp_) --function that checks if a position exists in a table of positions (cellPool) | |
| for _, val in pairs(cp_) do | |
| if val.x == x_ and val.y == y_ then | |
| return true | |
| end | |
| end | |
| return false |