Dear Arduino Ninjas, help improve my Monome-esque MIDI sequencer code..

Greetings,

I've been working on a project for a little while now. Its a monome-esque midi sequencer.. Arduino Mega 2560.. 2 Sparkfun buttonpads form an 8x4 grid representing 2 bars of 16th notes. The keypad scanning is done by 74x164/165.. the RGB LED Matrix is handled by shiftMatrixPWM from Elco Jacobs (4 x 74x595s here). An I2C 20x4 LCD w/ DFRobots library shows 8 parameters.. The params adjustable by 8 encoders (they have switches which i'll later use to cycle thru parameters) and the UI is rounded out with one more encoder/sw, 4 "arrow" buttons and 1 select button (all scanned by 74x165). Additionally, I've added 24lc256 to give it some extra space for saving patterns later..

Heres an photo if interested :

https://sphotos-b.xx.fbcdn.net/hphotos-snc7/477516_3981062490669_1056164383_o.jpg

So basically, I've got my code all up on gitHub and i can certainly answer any questions (especially since i haven't drawn a schematic yet) Included in there is a variety of test sketches used throughout the development..

So, I've got it all pretty much working.. it receives clock from another midi device (in my case, my korg electribe), and starts counting away and sending notes, all the while scanning the shift registers and pushing info out to the LED Matrix.. I'm running into a few problems

  1. Lag between notes, I've done some crude testing and I think the problem lies in the LCD updating
  2. Help tightening up the loops around the encoders / nav / keypad
  3. a better way to handle the encoders / UI overall?
  4. ShiftMatrixPWM uses an timer to service the LED Matrix - I'm sure this has something to do with my speed issues
  5. I want to add the ability for it to act as the master midi clock but with the general power required to service the UI, I'm afraid i'll have EVEN WORSE TIMING then!
  6. Is it worth adding a second arduino to service some of these UI bits or even act as a seperate "midi interface"? I've got an Uno laying around.. :slight_smile:

Any and all help is welcome, interested to see what the community says.