Help with MD_MIDIFile_Play_LCD.ino Example

Hello,

I am hoping to get some assistance with this sketch. I am using an Arduino Uno, DFRobot LCD Keypad Shield and micro SD card reader. Since the LCD is using D4 I changed the SD card CS to D3. I calibrated the resistor ladder with the values from MD_UISwitch_Test_Analog_Keys sketch. When I load the MD_MIDIFile_Play_LCD sketch I see the "Midi Player" title screen with underscores and it flickers with the underscores seeming to change to other characters, however the buttons do nothing. The SD reader seems to be functional because if I remove the card I get "Sd init fail" and if there are no files I get "No files". Also, it appears to build PLAYLIST.TXT correctly based on the files placed on the SD card. For troubleshooting I currently only have LOOPDEMO.MID on the card.

Below in the code section are the only sections of the MD_MIDIFile_Play_LCD.ino file that I have changed and here is a link to a YouTube video showing the behavior:

MD_MIDIFile_Play_LCD Test Video

Thank you.

// SD Hardware defines ---------
// SPI select pin for SD card (SPI comms).
// Arduino Ethernet shield, pin 4.
// Default SD chip select is the SPI SS pin (10).
// Other hardware will be different as documented for that hardware.
const uint8_t SD_SELECT = 3;


// Define the key table for the analog keys
MD_UISwitch_Analog::uiAnalogKeys_t kt[] =
{
	{   0, 30, 'R' },  // Right
	{ 131, 40, 'U' },  // Up
	{ 306, 50, 'D' },  // Down
	{ 480, 60, 'L' },  // Left
	{ 721, 60, 'S' },  // Select
};

It looks to me like the Arduino is resetting and you are getting the same opening display again and again, which causes that pulsing of the underlines. Everything you say is 'working' happens in setup().

When you compiled the program, what did you get as a summary for the compile? (memory and RAM)

Here's what I get from the upload output:

Compiling 'MD_MIDIFile_Play_LCD' for 'Arduino Uno'
Program size: 20,550 bytes (used 64% of a 32,256 byte maximum) (30.53 secs)
Minimum Memory Usage: 1836 bytes (90% of a 2048 byte maximum)

Interestingly, if I comment out the midiFSM in loop() then I am able to operate the file menu:

//case MIDISeq: s = midiFSM(s);	break;

Stats for that compile and upload:

Compiling 'MD_MIDIFile_Play_LCD' for 'Arduino Uno'
Program size: 15,390 bytes (used 48% of a 32,256 byte maximum) (55.40 secs)
Minimum Memory Usage: 1696 bytes (83% of a 2048 byte maximum)

Video:

MD_MIDIFile_Play_LCD Test 2

In MD_MIDIFile.h edit the define for MAX MIDI channels to 8. It is set at 16 at the moment. Then try again.

That worked, thank you!