The reason I ask is because I am having errors compiling with 3.2 (even when I comment out the line that deals with "word")
#define USE_SERIAL_PORT Serial1 // Change the number (to Serial1 for example) if you want
// to use a different serial port for MIDI I/O.
typedef uint8_t byte;
// typedef uint16_t word;
I've done a quick and dirty test of Midi 2.6 and the MIDI_Input_Test_Teensy sketch works most of the time. Midi 3.2 didn't work.
Do you have both 2.6 and 3.2 installed at once?
I don't have a MIDI_Input_Test_Teensy sketch in MIDI 3.2. Where does it come from? Do you have both 2.6 and 3.2 installed at once and if so, how do you know which one is being used?
3.2 has three examples - MIDI_BASIC_IO, MIDI_Callbacks and MIDI_Input. All three compile correctly with the board set to Teensy 3.0 (or 2.0, just checked that too).
Edit: OK, found that example in the 2.6 directory I had moved out of the way. Compiled with 3.2. No errors.
.... did not output MIDI.
Agreeing with your second sentence and correcting the first, the USB type can be anything, since USB is not being used here. Setting it to Serial means you want a virtual serial-over-USB set up (for example, to display debug messages on the Serial monitor).The board type should be serial. The MIDI 2.6 and 3.2 libraries don't use the T3 as a USB MIDI device. They just read/write midi messages on the Serial port.
That would be MIDI Out, on the Teensy. Which you would connect to MIDI In on your laptop audio interface.I am attempting to use MIDI IN actually to play notes on my laptop software via pushbuttons connected to the Teensy 3.0.
The USB type does not matter here, since you are not using USB to connect.I will try serial tonight after work (tomorrow morning) since I have actually been using MIDI as the board type this whole time.
I would use the 3V3 pin. Vin is unregulated (and is connected to the USB 5-ish volts, if I recall correctly).I have been using 47ohm resistors on the MIDI jack, but I am connected to VIN, not 3.3V so I have also tried 220ohm resistors. I will post hardware pictures if serial does not work.
[COLOR=#7E7E7E]/*[/COLOR]
[COLOR=#7E7E7E]Teensy 3 with MIDI DIN and MIDI library 3.2.[/COLOR]
[COLOR=#7E7E7E] Edit MIDI.h to send MIDI to Serial1 (pin 1)[/COLOR]
[COLOR=#7E7E7E] */[/COLOR]
#include <[COLOR=#CC6600]MIDI[/COLOR].h>
#define LED 13 [COLOR=#7E7E7E]// LED pin on Arduino board[/COLOR]
[COLOR=#CC6600]byte[/COLOR] note;
[COLOR=#CC6600]void[/COLOR] [COLOR=#CC6600][B]setup[/B][/COLOR]() {
[COLOR=#CC6600]MIDI[/COLOR].[COLOR=#CC6600]begin[/COLOR](1); [COLOR=#7E7E7E]// Launch MIDI on channel 1[/COLOR]
[COLOR=#CC6600]pinMode[/COLOR](LED, [COLOR=#006699]OUTPUT[/COLOR]);
[COLOR=#CC6600]digitalWrite[/COLOR](LED,[COLOR=#006699]LOW[/COLOR]);
[COLOR=#CC6600]delay[/COLOR](2000); [COLOR=#7E7E7E]// Wait for a bit before starting[/COLOR]
}
[COLOR=#CC6600]void[/COLOR] [COLOR=#CC6600][B]loop[/B][/COLOR]() {
note = [COLOR=#CC6600]random[/COLOR](32,70);
[COLOR=#CC6600]digitalWrite[/COLOR](LED,[COLOR=#006699]HIGH[/COLOR]); [COLOR=#7E7E7E]// Blink the LED[/COLOR]
[COLOR=#CC6600]MIDI[/COLOR].[COLOR=#CC6600]sendNoteOn[/COLOR](note,92,1); [COLOR=#7E7E7E]// Send a Note (pitch random, velo 3/4 on channel 1)[/COLOR]
[COLOR=#CC6600]for[/COLOR] ([COLOR=#CC6600]int[/COLOR] i=0; i<3000; i+=20) {[COLOR=#7E7E7E]// MIDI pitch bend range is +- 8k[/COLOR]
[COLOR=#CC6600]MIDI[/COLOR].[COLOR=#CC6600]sendPitchBend[/COLOR](i,1); [COLOR=#7E7E7E]// swoop a bit[/COLOR]
[COLOR=#CC6600]delay[/COLOR](12);
}
[COLOR=#CC6600]MIDI[/COLOR].[COLOR=#CC6600]sendNoteOff[/COLOR](note,0,1); [COLOR=#7E7E7E]// Stop the note[/COLOR]
[COLOR=#CC6600]digitalWrite[/COLOR](LED,[COLOR=#006699]LOW[/COLOR]);
[COLOR=#CC6600]delay[/COLOR](500); [COLOR=#7E7E7E]// Wait for a bit between notes [/COLOR]
}
// Default serial port configuration (if MIDI_AUTO_INSTANCIATE is set)
// Set the default port to use for MIDI.
#if MIDI_AUTO_INSTANCIATE
# ifdef ARDUINO
# ifdef USBCON
# define MIDI_DEFAULT_SERIAL_PORT Serial1 // For Leonardo
# else
# define MIDI_DEFAULT_SERIAL_PORT Serial // For other Arduinos
# endif
# define MIDI_DEFAULT_SERIAL_CLASS HardwareSerial
# include "Arduino.h"
# include "HardwareSerial.h"
# else
# error Auto-instanciation disabled. Use MIDI_CREATE_INSTANCE macro.
# endif
#endif
That would be MIDI Out, on the Teensy. Which you would connect to MIDI In on your laptop audio interface.
MIDI In on the Teensy would be the circuit with the optocoupler (which you would connect to MIDI Out on a keyboard or other controller).
The USB type does not matter here, since you are not using USB to connect.
I would use the 3V3 pin. Vin is unregulated (and is connected to the USB 5-ish volts, if I recall correctly).
is it not refreshing/referencing the library correctly?
Check the libraries folder inside your sketch folder, as well as the main libraries folder. You might have a copy in there as well, in which case the edits to the one in the main libraries folder will have no effect *cough* happend to a freind of mine *cough*
Check the libraries folder inside your sketch folder, as well as the main libraries folder. You might have a copy in there as well, in which case the edits to the one in the main libraries folder will have no effect *cough* happend to a freind of mine *cough*
Absolutely sure. a) just checked b) am looking at Teensy 3.0 on breadboard hooked up to MIDI socket c) it wouldn't upload correctly, otherwise.
Can you copy and paste your exact error message? Also, if you go Help > Abou Arduino what is the version number? (I wonder igf you have multiple versions installed and the one you are editing is not the one you are using).
Absolutely sure. a) just checked b) am looking at Teensy 3.0 on breadboard hooked up to MIDI socket c) it wouldn't upload correctly, otherwise.
Can you copy and paste your exact error message? Also, if you go Help > Abou Arduino what is the version number? (I wonder igf you have multiple versions installed and the one you are editing is not the one you are using).