This blog is really just a way to keep track of my Arduino experiments for my MSc project. It will probably be incredibly boring to anyone other than myself.
After a week or more I've finally managed to get the Arduino talking with Pure Data. Attempts at using the USB port to send serial messages that were then intended to be converted to MIDI using a MIDI-serial bridge (http://projectgus.github.io/hairless-midiserial/) were frustrating and fruitless. I'm now using the Arduino MIDI library (http://playground.arduino.cc/Main/MIDILibrary), I'm unsure if this is the best way to proceed but it's making things easier for now.
Currently I've only got a potentiometer sending CC messages to PD which isn't much use to the project but it's a start. There is some instability with the MIDI value flickering now and then when the pot isn't in use, I'm hoping that the use of data smoothing when using more complex sensors will rectify this. A distance sensor and piezos are the next sensors I intend to experiment with.
Below is the code and a diagram made in fritzing for the simple potentiometer patch. Hopefully the code doesn't get too mangled by blogger.
#include <MIDI.h>
void setup() {
MIDI.begin(); // Launch MIDI with default options
}
void loop() {
MIDI.sendControlChange(16, analogRead(0) / 8, 1); // (Control number, pot reading divided by 8, channel)
delay(5); //delay of 5ms before repeating loop
}
The pot is 50k and the resistor is 220ohm
No comments:
Post a Comment