Go Down

Topic: Arduino MEGA weird MIDI signals! (Read 532 times) previous topic - next topic


I have going on project of midi controller... And I have big trouble with it. This problem occurs every code what I try.

This is what happened...

I upload the code bellow in arduino and connect the pushbutton in pin 2. Midi data start sending signal rightaway without stopping ON, OFF, ON, OFF, ON, OFF, ON, OFF, ON, OFF,.... (well there is delay(1);).

I press the button and signal stops. Then I take arduino from table and place it on my hand and put finger like that it touch to Pin two, same pin where pushbutton is and Midi start working RIGHT.

I have tried to find everywhere the answer for problem but can't find anything.

Same thing happening midi shield and hairless-midi. I have tried to change baud rates but no luck. Is this some kind of grounding problem or is my arduino just broken?

Is there somebody who can help me with this???

Code: [Select]
#include <MIDI.h>

int pushButton2 = 2;
int buttonState2 = 0;
int note2 = 0;

void setup() {
//Serial.begin(115200); //for heirless-midi
pinMode(pushButton2, INPUT);


void loop() {
  int buttonState2 = digitalRead(pushButton2);
  // Button 2
  if (buttonState2 == HIGH) {
    if (note2 == 0) {
      note2 = 1;
  } else {
    if (note2 == 1) {
    note2 = 0;


Update... Looklike problem is digital pins. All digital pins have same problem, But code with analog pins work's just fine... If I put in code one potentiometer (analog) and one button (digital) analog work good but right at that moment when connecting button to Digital input, midi sending starts.


I have tried to find everywhere the answer for problem but can't find anything.
And you won't find one here unless you post your schematic.

Go Up