@@ -27,10 +27,11 @@ one MIDI interface. If you don't do that, you'll get an error when calling
27
27
There are many different MIDI interfaces to choose from:
28
28
29
29
- ` USBMIDI_Interface ` : On boards that support MIDI over USB natively, this will
30
- do exactly what you'd expect. You just have to plug it into your computer, and
31
- it shows up as a MIDI device.
30
+ do exactly what you'd expect: You just have to plug it into your computer, and
31
+ it shows up as a MIDI device.
32
32
On Arduinos without native USB capabilities (e.g. UNO or MEGA), you have to
33
33
use custom firmware for the ATmega16U2.
34
+ See @ref md_pages_MIDI-over-USB for details.
34
35
- ` HardwareSerialMIDI_Interface ` : This interface will send and receive MIDI
35
36
messages over a hardware UART. You can use it for MIDI over a 5-pin DIN
36
37
connector, for example.
@@ -39,15 +40,14 @@ There are many different MIDI interfaces to choose from:
39
40
the [ Hairless MIDI<->Serial Bridge] ( https://projectgus.github.io/hairless-midiserial/ ) .
40
41
In that case, you can use this MIDI interface. The default baud rate is 115200
41
42
symbols per second.
42
- - ` BluetoothMIDI_Interface ` : If you have an ESP32, you can send and receive MIDI
43
- messages over Bluetooth Low Energy. This interface is still very much
44
- experimental, but it's pretty cool. If you know more about the MIDI BLE
45
- protocol, feel free to suggest some improvements.
46
- - ` USBDebugMIDI_Interface ` : Debugging MIDI Controllers can be very cumbersome.
43
+ - ` BluetoothMIDI_Interface ` : If you have a board that supports Bluetooth Low Energy (BLE),
44
+ such as an ESP32 or a Raspberry Pi Pico W, you can send and receive MIDI
45
+ messages over Bluetooth. See @ref md_pages_MIDI-over-BLE for details.
46
+ - ` USBDebugMIDI_Interface ` : Debugging MIDI Controllers can be very cumbersome.
47
47
There are MIDI monitors available, but you have to reconnect every time you
48
48
upload a new sketch, and sending MIDI to the Arduino is not always easy.
49
- This interface is designed to help you with that. It prints outgoing MIDI
50
- messages to the Serial port in a readable format, and it allows you to enter
49
+ This interface is designed to help with that: It prints outgoing MIDI
50
+ messages to the Serial port in a readable format, and it allows you to enter
51
51
hexadecimal MIDI messages (as text) in the Serial monitor
52
52
(e.g. ` 90 3C 7F ` to turn on middle C).
53
53
@@ -58,9 +58,9 @@ For now, we'll use the `USBMIDI_Interface` because it's probably the one you'll
58
58
use in your final program. Do keep in mind that not all boards support MIDI over
59
59
USB natively, for more details, see the @ref md_pages_MIDI-over-USB page.
60
60
61
- You can give the interface any name you want. I'll be very original and
62
- choose ` midi ` . It doesn't matter, and you don't need to use it afterwards,
63
- just defining the interface is enough, the Control Surface library will
61
+ You can give the interface any name you want. Lacking originality, I'll choose
62
+ ` midi ` . The name doesn't matter, and you don't need to use it afterwards,
63
+ just defining the interface is enough, the Control Surface library will
64
64
automatically detect and use it.
65
65
66
66
``` cpp
@@ -72,14 +72,15 @@ USBMIDI_Interface midi;
72
72
> In that case, you can instantiate it as follows:
73
73
> ` USBDebugMIDI_Interface midi {115200}; `
74
74
75
- For a more detailed overview of MIDI interfaces and using them to send and
76
- receive MIDI message, have a look at the @ref midi-tutorial.
75
+ For a more detailed discussion of MIDI interfaces and how to use them to send
76
+ and receive MIDI message, have a look at the @ref midi-tutorial.
77
77
78
78
### 3. Add Extended Input/Output elements (optional) {#first-output-extio}
79
79
80
80
If your MIDI Controller requires many in- or outputs, you'll run out of IO pins
81
- really quickly. A solution is to use multiplexers or shift registers.
82
- The Control Surface Library supports both of these options, and makes it easy
81
+ quite quickly. A solution is to use multiplexers or shift registers to expand
82
+ the number of usable in- and outputs.
83
+ The Control Surface library supports both of these options, and makes it easy
83
84
to support other types of IO expanders in the future.
84
85
85
86
An overview of Extended Input/Output elements can be found in the @ref AH_ExtIO
@@ -105,9 +106,10 @@ CD74HC4051 mux { A0, {3, 4, 5} };
105
106
Now, we can specify the objects that read the input of the potentiometers and
106
107
send out MIDI events accordingly.
107
108
108
- Again, I'll refer to the overview of @ref MIDIOutputElements.
109
+ I'll again refer to the documentation for an overview of all supported
110
+ @ref MIDIOutputElements (including potentiometers, switches, rotary encoders, etc.).
109
111
110
- Let's define a single potentiometer on pin `A1` that sends out MIDI Control
112
+ Let's define a single potentiometer on pin `A1` that sends out MIDI Control
111
113
Change events.
112
114
In the @ref CCPotentiometer::CCPotentiometer "documentation",
113
115
you'll find that the first argument for the `CCPotentiometer` constructor is the
@@ -132,7 +134,7 @@ CCPotentiometer potentiometer { A1, {7, Channel_1} };
132
134
```
133
135
134
136
In our case, we don't want a single potentiometer, we want eight. It's much
135
- easier to define them in an array.
137
+ easier to define them in an [ array](https://www.learncpp.com/cpp-tutorial/introduction-to-c-style-arrays/) .
136
138
Also note how we declare that the potentiometers are connected to the the pins
137
139
of the multiplexer we defined in the previous step.
138
140
@@ -190,12 +192,11 @@ void setup() {
190
192
> ** Note** : If you forget to define a MIDI interface, ` Control_Surface.begin() `
191
193
> will raise an error and the on-board LED will start blinking.
192
194
> Other errors will also be indicated this way.
193
- > If you don't know why this happens, you should enable debug information in
194
- > the ` Control_Surface/src/AH/Settings/Settings.h ` file, and inspect the output
195
- > in the Serial Monitor.
196
- > Someday, I will add a "Troubleshooting" page. For now, if you have any
197
- > problems, just [ open an issue on GitHub] ( https://github.com/tttapa/Control-Surface/issues/new )
198
- > to remind me.
195
+ > If you don't know why this happens, you should enable debug information as
196
+ > described in the @ref getting-started_md-troubleshooting section below,
197
+ > and inspect the output in the Serial Monitor.
198
+ > If you cannot fix the issue based on the documentation, source code and
199
+ > @ref FAQ alone, feel free to [ start a discussion on GitHub] ( https://github.com/tttapa/Control-Surface/discussions )
199
200
200
201
### 6. Continuously Update the Control Surface {#first-output-loop}
201
202
@@ -302,10 +303,10 @@ requiring any more pins.
302
303
Each of the eight outputs of the shift register can be connected to the anode of
303
304
an LED. Connect the cathodes to ground through a current-limiting resistor.
304
305
305
- Connect the clock input (SH_CP or SRCLK) of the shift register to the Arduino's
306
- SCK pin, the serial data input (DS or SER) of the shift register to the
307
- Arduino's MOSI pin, and the latch pin (ST_CP or RCLK) of the shift register to
308
- digital pin 10 of the Arduino. Connect the Output Enable pin (OE ) of the shift
306
+ Connect the clock input (` SH_CP ` or ` SRCLK ` ) of the shift register to the Arduino's
307
+ SCK pin, the serial data input (` DS ` or ` SER ` ) of the shift register to the
308
+ Arduino's MOSI pin, and the latch pin (` ST_CP ` or ` RCLK ` ) of the shift register to
309
+ digital pin 10 of the Arduino. Connect the Output Enable pin (` OE ` ) of the shift
309
310
register to ground, and the Master Reset (MR) pin of the shift register to Vcc
310
311
to enable it.
311
312
0 commit comments