MIDI Elements
Library to simplify handling of components for MIDI controllers
 All Classes Files Functions Variables Macros
Button Class Reference

Class for handling push button switches. More...

#include <Button.h>

Public Member Functions

 Button (byte p)
 constructor with pin number. More...
 
 Button (byte p, byte c, byte n)
 constructor with pin number, midi channel and midi note. More...
 
 Button (byte p, byte c, byte n, bool sec)
 constructor with pin number, midi channel, midi note and secondary messages. More...
 
 Button (byte p, byte c, byte n, bool sec, bool debug)
 constructor with pin number, midi channel, midi note, secondary messages and debugging. More...
 
 ~Button ()
 
void read ()
 read the values and send a midi message if the button state changed. use in main loop More...
 
bool readValue (bool &changed)
 read the values and return if the button is pressed, pass state change More...
 
void setVelocity (byte v)
 change the note on velocity value of the outgoing midi message. More...
 

Detailed Description

Class for handling push button switches.

Connect the button to ground and input pin, there is no need for a pull-up resistor, it is enabled internally. Enable Secondary to send secondary CC messages. (used for mapping momentary switches in Ableton) Enable debug to print to serial port instead of midi.

Constructor & Destructor Documentation

Button::Button ( byte  p)

constructor with pin number.

Parameters
ppin number
Button::Button ( byte  p,
byte  c,
byte  n 
)

constructor with pin number, midi channel and midi note.

Parameters
ppin number
cmidi channel
nmidi note
Button::Button ( byte  p,
byte  c,
byte  n,
bool  sec 
)

constructor with pin number, midi channel, midi note and secondary messages.

Parameters
ppin number
cmidi channel
nmidi note
secenable secondary messages
Button::Button ( byte  p,
byte  c,
byte  n,
bool  sec,
bool  debug 
)

constructor with pin number, midi channel, midi note, secondary messages and debugging.

Parameters
ppin number
cmidi channel
nmidi note
secenable secondary message
debugenable debugging
Button::~Button ( )

Member Function Documentation

void Button::read ( )

read the values and send a midi message if the button state changed. use in main loop

bool Button::readValue ( bool &  changed)

read the values and return if the button is pressed, pass state change

Parameters
changedwill beset to true if the state of the button changed
void Button::setVelocity ( byte  v)

change the note on velocity value of the outgoing midi message.

Parameters
vset velocity value

The documentation for this class was generated from the following files: