Im very new to this and Im trying to program a MIDI button
I get the Error 'MIDI_controller' was not declared in this scope on line 14
Im, sure it's a simple fix
Could anyone help show me what's wrong and how to fix it?
Code:
---
``` #include<MIDI_controller.h>// Include the library
constuint8_tvelocity=0b1111111;// Maximum velocity (0b1111111 = 0x7F = 127) constuint8_tC4=60;// Note number 60 is defined as middle C in the MIDI specification
// Refresh the button (check whether the button's state has changed since last time, if so, send it over MIDI) MIDI_controller.refreshcolor=#000000[/color]; } ```
#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
MIDI_controller myMIDI;
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)
myMIDI.refresh();
}
But no guarantees because I have not seen the library
sketch_sep21b:7: error: expected initializer before 'myMIDI'
sketch_sep21b.ino: In function 'void loop()':
sketch_sep21b:16: error: 'myMIDI' was not declared in this scope
expected initializer before 'myMIDI'
sketch_sep21b.ino: In function 'void loop()':
sketch_sep21b:30: error: 'MIDI_controller' was not declared in this scope
'MIDI_controller' was not declared in this scope
This is the example Code
Code:
---
``` #include<MIDI_controller.h>// Include the library
constuint8_tvelocity=0b1111111;// Maximum velocity (0b1111111 = 0x7F = 127) constuint8_tC4=60;// Note number 60 is defined as middle C in the MIDI specification
// Refresh the button (check whether the button's state has changed since last time, if so, send it over MIDI) MIDI_controller.refreshcolor=#000000[/color]; } ```
made by a guy as apart of this Instructables tutorial
Never ever use instrutables to learn stuff especially if you are a beginner. The quality of this web site is appalling and virtually every article I have seen contains error.
It is mainly written by beginners with an over inflated idea of their own abilities. Never trust a library where the examples don’t work.
Also please post code correctly using the </> code tabs icon, not the tables icon you used.
Read the how to use this forum sticky post.
The Instructable may have some issues but its the best and most comprehensive guide I have found. It's very clear and many other people have used It with great success. It's also the only one that uses a Leonardo Board instead of an Uno.
The Instructable may have some issues but its the best and most comprehensive guide I have found.
Then try looking harder, you will get into a mess with Instructable and here we are sick and tired of trying to clean up after their stupid mistakes. Most authors are so stupid that they can't draw a schematic of what they are presenting. They also confuse a Fritzing ( very crap ) layout diagram for a schematic.
It's very clear and many other people have used It with great success.
Read the comments, half of then say it doesn't work or ask for some stupidly impossible thing.
It's also the only one that uses a Leonardo Board instead of an Uno.
So now you tell us. I know you said that before but it was without the context that you were trying to follow the instructions for use with a Uno. It makes a difference, but not to the stupid mistake that he made with the example code.
However, it might make a difference to his library. The Leonardo uses a different processor to the Uno so any processor dependent features might not work. But it is capable of directly connecting to the USB port of a laptop and looking like a HID MIDI device. That means it doesn't need any helper applications like Hairless to run in your laptop.
Im very new to this and Im trying to program a MIDI button
You might have multiple libraries installed that provide a "MIDI_controller.h" file. Delete all these other libraries, install the latest version of "tttapa/MIDI_controller" from GitHub, and try again.