Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Woodward equaliser

  • University of Warwick
  • Coventry, UK
View GitHub Profile
View basic_din_sync_to_midi.pde
#include <digitalWriteFast.h>
// din sync to midi
// pins
#define DINSYNC_STARTSTOP 3
#define DINSYNC_CLOCK 2
// midi pin 5 > 220ohm resistor > D1
// midi pin 2 > ground
// midi pin 4 > 220ohm resistor > +5V
@equaliser
equaliser / mcp4922-test-teensy3-fastspi.ino
Created Jan 2, 2014
Testing the MCP4922 with the spi4teensy3 fast SPI library. (https://github.com/xxxajk/spi4teensy3)
View mcp4922-test-teensy3-fastspi.ino
/*
MCP4922 DAC test with spi4teensy3 fast SPI library, Teensy 3.0
mostly pinched from http://forum.pjrc.com/threads/24082-Teensy-3-mcp4921-SPI-Dac-anybody-tried
will need the spi4teensy3 library (https://github.com/xxxajk/spi4teensy3) copying into the libraries folder
at SPI_CLOCK_DIV2 (24MHz on standard Teensy 3.0)
generates ramp wave with period of 13.8ms (72hz)
@equaliser
equaliser / mcp4922-test-teensy3-spi.ino
Last active Mar 31, 2020
Testing the MCP4922 DAC with the standard SPI library included with the Teensy 3/Teensyduino.
View mcp4922-test-teensy3-spi.ino
/*
MCP4922 DAC test with standard SPI library, Teensy 3.0
mostly pinched from http://forum.pjrc.com/threads/24082-Teensy-3-mcp4921-SPI-Dac-anybody-tried
if we delete the delay(5) in the loop
at SPI_CLOCK_DIV2 (24MHz on standard Teensy 3.0)
generates 50hz ramp wave
clock period ~42ns
@equaliser
equaliser / dualFrequencyCounter.ino
Last active Oct 2, 2017
Arduino dual audio frequency counter and pulse width measuring sketch.
View dualFrequencyCounter.ino
/* DualFrequencyCounter */
// is a bit sketchy, but seems accurate enough.
// Relies on
// - Adafruit's SPI_VFD library
// - one of those fancy Samsung 20x2 VFDs
// - and the usual digitalWriteFast lib which I know you've already got.
// checked with a DSO Nano oscilloscope, not that they're all that great
View rainbow.scala
import Console._
import scala.util.Random
val colours = Seq(BLUE, CYAN, GREEN, MAGENTA, RED, YELLOW)
def rainbow(text: String, colours: Seq[String]) = text.zipWithIndex.map{ case (c,i) => colours(i%colours.size)+c }.mkString + RESET
for (a <- 1 to 20) println(rainbow("Yeah cool colours", Random.shuffle(colours.toList)))
@equaliser
equaliser / gist:5194456
Created Mar 19, 2013
Arduino MCP4922 SPI DAC demo code
View gist:5194456
/*
MCP4922 test
Steve Woodward, 2010
most code borrowed from
http://mrbook.org/blog/2008/11/22/controlling-a-gakken-sx-150-synth-with-arduino/
connections
====================================================
+5v > 4922 pin 1
@equaliser
equaliser / mcp4922test.pde
Last active Jun 16, 2016
Arduino to MCP4922 test code
View mcp4922test.pde
/*
MCP4922 test
outputs steadily rising voltages through both DACs
Steve Woodward, 2010
most code borrowed from
http://mrbook.org/blog/2008/11/22/controlling-a-gakken-sx-150-synth-with-arduino/
connections
====================================================
@equaliser
equaliser / gist:1981269
Created Mar 5, 2012
Simple voltage controlled clock with pulse width
View gist:1981269
/*******************************************************/
/* Dead simple voltage controlled clock
/* adjustable pulse width
/*
/* intended for use as a master clock for a sequencer
/* designed for Arduino Duemilanove (Atmega 168)
/* you might need to change the port numbers for
/* Arduino Mega/other Arduinos
/*
/* Steve Woodward, Mar 2012
You can’t perform that action at this time.