Hello, first post here.
This morning i got the Sparkfun Musical Instrument Shield by male,
This is how i got it working pretty quickly on the Maple-r5
Please add it to the compatability list
/*
Title : Musical_instrument_Demo
Function : Verry basic demo how to use the Sparkfun Musteic Instrument shield on the Maple
Author : Pascal Schiks (C) 2011 GNU/GPL
Notes :
This is how i got the SparkFun MusicalInstrument Shield with the STM32F103 chip to work.
I tried this shield only in MIDI mode yet (it's fairly easy to convert to MP3 mode)
On the Arduino softSerial is used to drive the MIDI-chip wich listens on pin-3.
Since i think soft serial is not a verry good idea if you planning timecritical stuff like MIDI,
I decided to use the hardware serial which Maple has three options for.
You may either connect pin-3 to pin-7 for Serial1, to pin-2 for Serial2, or to Pin-29 for Serial3
Note that using Serial2 might clash into the MIDI-shield if you are stacking this with the Musical-Instrument.
Also you must not forget to reset the MIDI-chip, by lowerering Pin-4 for a short while
For the rest this code is pretty much a copy of the MIDI-shield demo
*/
void noteOn(int cmd, int pitch, int velocity)
{
Serial1.print(cmd, BYTE);
Serial1.print(pitch, BYTE);
Serial1.print(velocity, BYTE);
}
void noteOff()
{
}
void setup()
{
// Reset the MIDI-chip
pinMode(4, OUTPUT);
digitalWrite(4, LOW);
delay(100);
digitalWrite(4, HIGH);
delay(100);
// Set MIDI baud rate:
Serial1.begin(31250);
}
void loop()
{
// play notes from F#-0 (0x1E) to F#-5 (0x5A):
for (int note = 0x1E; note < 0x5A; note ++)
{
//Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
noteOn(0x90, note, 0x45);
delay(100);
//Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
noteOn(0x90, note, 0x00);
delay(100);
}
}