This is a simple example of using an infrared distance sensor as a MIDI controller. The hardware setup is simple - analog out to analog input on the Teensy, ground to ground and 5V to 5V.
The code is as follows:
byte current;
byte previous;
void setup() {
}
void loop() {
current = analogRead(0) / 8;
if(current != previous) {
previous = current;
sendControlChange(1, current, 1);
delay(5);
}
}
Thursday, May 16, 2013
Subscribe to:
Post Comments (Atom)
2 comments:
Hey Sebastian. First let me say, I love your project! I'm completely new to arduino and was wondering if you could help me out. I purchased the exact parts you have displayed on this blog (teensy board, breadboard, and IR sensor). I was just wondering where you inserted the IR wires onto the breadboard and how exactly you began to use it as a MIDI controller. I downloaded the Arduino software and teensy download. Did you run it through a DAW and map it? Hopefully you can help me out. Thank you!
-Josias
Hi Josias,
One of the outside legs of the sensor goes to 5V, the other outside leg goes to ground, and the middle leg goes to an analog input.
In this case, its analog in 0.
You can find the Teensy pinout here: http://www.pjrc.com/teensy/pinout.html
Hope that helps!
- Seb
Post a Comment