Sunday, September 15, 2013

Ping-Based YES NO Swipe Interface



I made a simple YES / NO swipe interface using a Teensy and two Ping distance sensors.

The ping signal pin is connected to pins 7 and 8 (for the YES and NO Pings respectively).

There are values in the code that set the min, max and time-based parameters for when a swipe is recognised as being a swipe.

They are:

long distance_min = 800; // change to set minimum swipe range distance
long distance_max = 2200; // change to set maximum swipe range distance
int swipe_reactivity = 2; // change to set swipe reactivity in time
int swipe_delay = 1000; // change to set delay after positive swipe is read

The YES swipe is transmitted by a Serial port message at 9600 baud saying "swipe yes", as well as a USB MIDI control change message of channel 1, controller 1 and value 127.

The YES swipe is transmitted by a Serial port message at 9600 baud saying "swipe no", as well as a USB MIDI control change message of channel 1, controller 2 and value 127.

An example Max patch which differentiates these values is as follows:



Download the Arduino Teensy code here: http://milkcrate.com.au/_other/useless/swiper.zip

No comments:

Post a Comment