Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View equaliser's full-sized avatar

Steve Woodward equaliser

  • University of Warwick
  • Coventry, UK
View GitHub Profile
@equaliser
equaliser / gist:1981269
Created March 5, 2012 21:38
Simple voltage controlled clock with pulse width
/*******************************************************/
/* 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
@equaliser
equaliser / mcp4922test.pde
Last active June 16, 2016 13:15
Arduino to MCP4922 test code
/*
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:5194456
Created March 19, 2013 08:18
Arduino MCP4922 SPI DAC demo code
/*
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
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 / dualFrequencyCounter.ino
Last active October 2, 2017 14:44
Arduino dual audio frequency counter and pulse width measuring sketch.
/* 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
@equaliser
equaliser / mcp4922-test-teensy3-spi.ino
Last active June 27, 2022 07:41
Testing the MCP4922 DAC with the standard SPI library included with the Teensy 3/Teensyduino.
/*
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 / mcp4922-test-teensy3-fastspi.ino
Created January 2, 2014 07:39
Testing the MCP4922 with the spi4teensy3 fast SPI library. (https://github.com/xxxajk/spi4teensy3)
/*
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)
#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