Skip to content

Instantly share code, notes, and snippets.

View CodeZombie's full-sized avatar
🌵

Jeremy Clark CodeZombie

🌵
View GitHub Profile
@CodeZombie
CodeZombie / main.cpp
Last active July 8, 2018 13:06
Arduino Midi Sequencer
//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
@CodeZombie
CodeZombie / ardmidsnip.c
Created July 3, 2017 23:07
Arduino Midi Snippets
//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);
@CodeZombie
CodeZombie / ssd1306esp8266.txt
Created May 2, 2017 21:07
SSD1306 on the ESP8266 D1 Mini
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.
@CodeZombie
CodeZombie / mobb.cpp
Created April 27, 2017 23:33
memory optimized bouncing balls for arduino
/*********************************************************************
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,
@CodeZombie
CodeZombie / SSD1306_ArduinoUno
Created April 27, 2017 21:30
Quickstart guide to the SSD1306 on an Arduino UNO
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:
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_;
@CodeZombie
CodeZombie / aliExpressAPI.go
Created November 6, 2016 05:44
Very simple aliexpress item api written in Go
package main
import (
"fmt"
"strings"
"net/http"
"strconv"
"regexp"
"github.com/PuerkitoBio/goquery"
)
@CodeZombie
CodeZombie / noise.c
Last active September 29, 2018 22:13
procedural noise generator in C.
#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);
@CodeZombie
CodeZombie / ttt.go
Created May 22, 2016 19:13
deep search tictactoe ai
/*Deep search tic tac toe ai console game
written may 2016 by Jeremy Clark */
package main
import (
"fmt"
"os"
"os/exec"
)
@CodeZombie
CodeZombie / generateCellsFromDNA.lua
Created April 7, 2016 06:24
Recursive function for generating unique cell patterns given a base4 string of "dna"
--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