Go Down

Topic: Scroll a list of stored values on LCD (Read 515 times) previous topic - next topic

SoundGuyAndy

Hey everybody,
I can't believe this hasn't been discussed before, but I can't for the life of me figure out what to search for if it has, so forgiveness if it's redundant!

I'm trying to figure out how to read in a list of values from the serial port (MIDI messages, specifically, presumably using the new-ish MIDI library, so I don't have to reinvent the wheel :)), and then display those messages on the screen as a scrollable list.

I'm basically trying to create a standalone equivalent of the Mac program MIDI Monitor, if that helps. (http://www.snoize.com/MIDIMonitor/)

There are a couple existing similar projects with other processors, but I'd like to figure it out with Arduino, both for the sake of learning how to do it, and because I want to add some other features to it, as well.

Any guidance is appreciated!

Best,
Andy

skumlerud

I made a scrollable list on LCD just a couple of days ago :-) In my case the items on the list is store in an array in EEPROM, so the actual code might not be suitable for your project. I don't have the code here, PM me if you want to take a look at it later.

The list is very simple, as it's controlled by three buttons (up, down, select) only. It use the entire width of the LCD, and always the three upper rows. I move a cursor up/down, and scroll the list when the cursor is at the top or bottom of the display. The code looks roughly like this:

Code: [Select]

byte number_of_items = 10; // Total number of items in the menu
byte cursor_at_line = 0; // Location (row) of cursor on the display.
byte cursor_at_item = 0; // Which item the cursor is at.

// Called when the UP-button is pressed
void move_cursor_up()
{
 if (cursor_at_line > 0) // Cursor not at top, just move cursor.
 {
   cursor_at_line--;
   cursor_at_item--;
   refresh_display(); // Draws the correct items to the LCD
   return;
 }

 if (cursor_at_item > 0) // Cursor at top.
 {
   cursor_at_item--;
   refresh_display();
 }
}

// Called when the DOWN-button is pressed
void move_cursor_down()
{
 if (cursor_at_line < 2) // Cursor not at bottom, just move cursor.
 {
   cursor_at_line++;
   cursor_at_item++;
   refresh_display(); // Draws the correct items to the LCD
   return;
 }

 if (cursor_at_item < number_of_items - 1) // Cursor at bottom.
 {
   cursor_at_item++;
   refresh_display();
 }
}

// Update the display. Use cursor_at_item and cursor_at_line
// to determine which items to display and where to draw the
// cursor.
void refresh_display()
{
}


You need to create a special case where the number of items is less than the height of the list area on the LCD.

Go Up