This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
2.First-Input.ino

2.First-Input

This is the second example used in the 'Getting Started' guide: https://tttapa.github.io/Control-Surface/Doc/Doxygen/dd/dcc/md_Getting-Started.html

Boards:
AVR, AVR USB, Teensy 3.x, ESP32

Written by PieterP, 2018-08-29
https://github.com/tttapa/Control-Surface

// Include the library
// Instantiate a MIDI Interface to use
// Instantiate a shift register as output for the LEDs
10, // Latch pin (ST_CP)
MSBFIRST, // Byte order
};
using namespace MIDI_Notes;
// Create an array of LEDs that listen to MIDI Note messages, turning on and off
// the LEDs connected to the eight input pins of the shift register
NoteValueLED leds[] = {
{sreg.pin(0), note(C, 4)}, // LED pin, address (note number, channel, cable)
{sreg.pin(1), note(D, 4)}, //
{sreg.pin(2), note(E, 4)}, //
{sreg.pin(3), note(F, 4)}, //
{sreg.pin(4), note(G, 4)}, //
{sreg.pin(5), note(A, 4)}, //
{sreg.pin(6), note(B, 4)}, //
{sreg.pin(7), note(C, 5)}, //
};
// Initialize the Control Surface
void setup() {
}
// Update the Control Surface
void loop() {
}
MIDI_Notes::A
constexpr int8_t A
Definition: Notes.hpp:27
USBMIDI_Interface
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
Definition: USBMIDI_Interface.hpp:43
MIDI_Notes::G
constexpr int8_t G
Definition: Notes.hpp:25
MIDI_Notes::E
constexpr int8_t E
Definition: Notes.hpp:22
SPIShiftRegisterOut
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
Definition: SPIShiftRegisterOut.hpp:23
Control_Surface.h
The main header file that includes all Control-Surface header files.
Control_Surface
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
Definition: Control_Surface_Class.cpp:171
MIDI_Notes::note
constexpr int8_t note(int8_t note, int8_t numOctave)
Get the MIDI note in the given octave.
Definition: Notes.hpp:35
ExtendedIOElement::pin
pin_t pin(pin_t pin) const
Get the extended IO pin number of a given physical pin of this extended IO element.
Definition: ExtendedIOElement.cpp:26
NoteValueLED
Definition: NoteCCRangeLEDs.hpp:44
MIDI_Notes::D
constexpr int8_t D
Definition: Notes.hpp:20
Control_Surface_::begin
void begin()
Initialize the Control_Surface.
Definition: Control_Surface_Class.cpp:22
MIDI_Notes::B
constexpr int8_t B
Definition: Notes.hpp:29
MIDI_Notes::C
constexpr int8_t C
Definition: Notes.hpp:18
MIDI_Notes
MIDI note names.
Definition: Notes.hpp:16
Control_Surface_::loop
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
Definition: Control_Surface_Class.cpp:45
MIDI_Notes::F
constexpr int8_t F
Definition: Notes.hpp:23