I bought an arduino leonardo, because it had more analogs than an UNO. My project is to use flex sensors and use them to do midi and eventually build a Max for Live patch for it. I have run into the problem of the leonardos digital serial. It doesn't play nice like the UNO. I have seen the arcore github, but feel like this is a jenky way by changing the processor? Am i overreacting? I felt like this was going to be simple. Should i continue with leonardo or for future reference use an UNO with a multiplexer?
I was using an instructable that said with an UNO i needed a serial bridge with this program. In their code, it uses plain the function serial instead of serial1.
Maybe I dont get the difference between the serial or serial1.
Does serial do digital (usb) and serial1 does it through the hardware?
My main question is how to get ableton/M4L to respond to the flex sensors. Im starting to wonder if I need a serial bridge for leonardo?
Hmm. Ill take note on the instructables being crap. I also have been hearing bad things about the new IDE
My idea is to get an array of around 12 flex sensors to create kind of a midi "harp". I want this to be midi so I can use it with ableton and such, and be able to modify pick a scale. I am hoping I was at least going in the right direction with the serial thing. Here is the code the gave me. (side note its not responding to their serial bridge or Im not finding the IAC or response im supposed to get?)
byte noteON = 144;//note on command
int analogPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int analogVal = analogRead(analogPin);//read data
//we have to scale the lsr data to fit between 0 and 127 (this is the range of MIDI notes)
byte note = map(analogVal, 0, 400, 0, 127);//use the 0-900 range I measured
MIDImessage(noteON, note, 100);//turn note on
delay(300);//hold note for 300ms
MIDImessage(noteON, note, 0);//turn note off (note on with velocity 0)
delay(200);//wait 200ms until triggering next note
}
//send MIDI message
void MIDImessage(byte command, byte data1, byte data2) {
Serial.write(command);
Serial.write(data1);
Serial.write(data2);
}
You need to set the baud rate at what the bridge wants. A rate of 9600 is way lower than the midi rate anyway, it is nothing to do with the sensors.
What do you mean by delaying the code? Have you read what is says about that type of Arduino on the official page the bit on USB enumeration?
What are you feeding the bridge into? That will determin what you see.
I think we are suffering because we don't know what you are doing, can you explain more your hardware setup and how you hope that will be seen as MIDI by your computer.
The 9600 baud rate was from the instructables again. I'm wondering if I will ever trust that website.
"You are not waiting for the serial port to become active."
So I thought I need to delay the code.
The setup is computer to usb to arduinio. I have a breadboard, a resistor, three wires for (ground, signal, and voltage), and the flex sensor. I'm not seeing anything in the Hairless Midi (Thats where my problem originated). I thought that the computer would see it in the Audio/Midi setup or in Ableton as IAC
I will not ever use instructables again. Thanks for your help Grumpy Mike. I am going to try to attack this on my own for a bit. I know I will learn a bit more by doing that.
I figured out the problem. The micro USB wire was faulty. It would give power to the LEDs sometimes so it looked like it was on, but in actuality it was broken. Everything works now!! Thanks for the help!!