# Problems with code midi

**URL:** <https://forum.arduino.cc/t/problems-with-code-midi/1336681>\
**Category:** Programming\
**Created:** [December 28, 2024, 6:50pm UTC](https://forum.arduino.cc/t/problems-with-code-midi/1336681 "2024-12-28T18:50:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcoesse22](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/marcoesse22/32/531171_2.png) [@marcoesse22](https://forum.arduino.cc/u/marcoesse22)\
**Post date:** [December 28, 2024, 6:50pm UTC](https://forum.arduino.cc/t/problems-with-code-midi/1336681/1 "2024-12-28T18:50:37Z")

</div>

I would like to add a second button what should I add

```arduino
#include <MIDI_Controller.h> // Include the library

const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127)
const uint8_t C4 = 60; // Note number 60 is defined as middle C in the MIDI specification

// Create a new instance of the class 'Digital', called 'button', on pin 2, that sends MIDI messages with note 'C4' (60) on channel 1, with velocity 127
Digital button(2, C4, 1, velocity);

void setup() {}

void loop() {
  // Refresh the button (check whether the button's state has changed since last time, if so, send it over MIDI)
  MIDI_Controller.refresh();
}

```

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [December 28, 2024, 8:07pm UTC](https://forum.arduino.cc/t/problems-with-code-midi/1336681/2 "2024-12-28T20:07:38Z")

</div>

You are going to need to tell us a lot more. You will be writing the code, our job is to help when you get stuck, similarly with wiring. So when you have done some research (google) show us all your code in code tags, any error logs also in code tags and just a photo of a hand drawn wiring diagram will suffice.

---

<div class="post-metadata">

**Author:** ![PieterP](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@PieterP](https://forum.arduino.cc/u/PieterP)\
**Post date:** [December 28, 2024, 9:01pm UTC](https://forum.arduino.cc/t/problems-with-code-midi/1336681/3 "2024-12-28T21:01:39Z")

</div>

> [@marcoesse22](#):
>
> `#include <MIDI_Controller.h>`

Please see the MIDI Controller README:

> The MIDI Controller library has been obsoleted by its successor, the [Control Surface](https://github.com/tttapa/Control-Surface) library.

You can just instantiate multiple NoteButton variables or create an array of them. See e.g. [Control Surface: Getting Started](https://tttapa.github.io/Control-Surface/Doxygen/d5/d7d/md_pages_Getting-Started.html).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 26, 2025, 9:02pm UTC](https://forum.arduino.cc/t/problems-with-code-midi/1336681/4 "2025-06-26T21:02:11Z")

</div>

Closed on June 26, 2025, 9:02pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
