Hello to all... I have a program running on a Mega that listens for incoming midi and positions two servos that play a glockenspiel with two more servos. This all works perfectly without issue.
What I need to do is exchange listening for midi data to listening for single characters through serial instead. This is where I'm having trouble and need advice.
Below is what I have that works perfectly for midi data:
Suitcase1arduinoforum (attachment)
and below is my adaptation of this code to read from the serial monitor. Using letters a-j instead of midi notes. I have used the built in LED to test that it will blink when receiving 'a' but while the code compiles ok, the led won't blink.
Just uploaded again.
What's up with this now...."The message exceeds the maximum allowed length (9000 characters)."
forced me to make attachments which I've never had to do before.
The .txt file seems a bit mangled, but in the Suitcase2 version you don't appear to actually be calling the code which interprets the byte read from the serial port:
void loop() {
// read serial
if (Serial.available() > 0) {
int inByte = Serial.read();
}
}
Nothing calls hitBeater or moveToMidiNote. Is something being lost in translation here?
goatboyrobbie:
Just uploaded again.
What's up with this now...."The message exceeds the maximum allowed length (9000 characters)."
forced me to make attachments which I've never had to do before.
Your code is greater than 9K. You have to attach.
Also, the files you posted have some kind of formatting issues. In any case, in loop() you are performing a Serial.read() into a local variable inByte but doing nothing with it, therefore nothing is happening.
void loop() {
// read serial
if (Serial.available() > 0) {
int inByte = Serial.read();
}
}