Take a look at this example:
Control-Surface/Doc/Doxygen/Ex.17.Transposer.ino-example.html
|
Code: --- |
|---|
|
``` #include <Control_Surface.h> |
Digital buttons[] = {
{2, 0x3C, 1}, // pin 2, note C4, channel 1
{3, 0x3E, 1}, // pin 3, note D4, channel 1
{4, 0x40, 1}, // pin 4, note E4, channel 1
{5, 0x41, 1}, // pin 5, note F4, channel 1
{6, 0x43, 1}, // pin 6, note G4, channel 1
{7, 0x45, 1}, // pin 7, note A4, channel 1
{8, 0x47, 1}, // pin 8, note B4, channel 1
{9, 0x48, 1}, // pin 9, note C5, channel 1
};
Bank transposedButtons; // Create a bank (i.e. collection of buttons and other inputs)
Transposer transposer(transposedButtons, {10, 11}, -12, +12); // Create a transposer that works on the bank,
// with an increment button on pin 10 and a
// decrement button on pin 11,
// with a minimum of -12 semitones (i.e.
// one octave lower) and a maximum of +12
// semitones (i.e. one octave higher).
void setupcolor=#000000[/color] {
transposedButtons.addcolor=#000000[/color]; // Add the buttons to the bank
}
void loopcolor=#000000[/color] {
Control_Surface.refreshcolor=#000000[/color]; // refresh everything
}
```
|
Also, you can't start the hardware UART on pins 0 and 1, and then start SoftwareSerial on the same pins. Just don't use SoftwareSerial. Ever.
The Control-Surface library used above handles the setup of the Serial ports for you if you just use the default settings.
Pieter