please help me understand button functions

okay, i always end up running in to this problem and i do not fully understand what/why i do the things i do.

i pretty much always end up dealing with midi projects with the arduino.

here is an example of what the problem is:

if (note1.uniquePress()) { 
Serial.println("Sending note");  
  }
  else { 
Serial.println("Turn off note"); 
  }

the problem is, the else command to "turn note off" slams my midi device (or in this case the serial monitor) with constant messages.
using AlphaBeta's button library with the "uniquepress" function makes it so the send note message is sent only once, so that part is good.

when i have 10 or so buttons all shooting out constant note off messages it causes my midi devices to freak out and hang up.

it would be awesome if i could fully understand how to press a momentary button and have it send just one message, then then i release the button have it send out just one different message.

u need to keep track of button states, since note1.uniquePress() has just 2 possible results: true / false...

there r 2 possibilities to store such states:
1.u can use one bit of a uint16_t per button...
2. or u use one byte (uint8_t) per button...

after calling note1.uniquePress() u compare the result with the last state and act accordingly...

-arne