Arduino MIDI controller: using more than 4 inputs

Hey guys,

I'm working on a MIDI controller that uses the 6 analog inputs and 2 or 4 digital ones on the duemillanove. I got my basic setup working but now I find that it won't read more than 4 inputs.
Is that maybe a restriction on the arduino board? Or is it down to not having enough power (I use the power from the USB)? Or the script?

// Arduino MULTI MIDI CC script

//ARRAYS FOR ANALOG
int inputsAnalog[] = {0, 1, 2, 3, 4, 5};
int channelsAnalog[] = {1, 2, 3, 4, 5, 6};
int lastAnalogs[]= {0, 0, 0, 0, 0, 0};

//ARRAYS FOR DIGITAL
int inputsDigital[] = {4, 7, 8, 12, 13};
int channelsDigital[] = {1, 2, 4, 5, 6, 7};
int lastDigital[]= {LOW, LOW, LOW, LOW, LOW, LOW};

//ANALOG SMOOTHING
int analogSmooth = 2;
long time = 0;
long debounce = 200;
int previous = LOW;

void setup()
{
Serial.begin(9600);
}

void loop()
{
for (int i=0; i<2; i++)
{
doReadAnalog(i, inputsAnalog, channelsAnalog_, lastAnalogs*);
} *_

* for (int i=0; i<2; i++)*
* {*
doReadDigital(i, inputsDigital_, channelsDigital*);
}
}
void doReadAnalog(int i, int input, int channel, int lastAnalog)
{
int readingAnalog = 0;
readingAnalog = analogRead(input)/8;
if (abs(readingAnalog-lastAnalog) > analogSmooth)
{
lastAnalogs = readingAnalog;
controlChange(channel, 10, readingAnalog); // Send CC10*

* }
}
void doReadDigital(int i, int input, int channel)
{
int readingDigital = 0;
readingDigital = digitalRead(input);*_

_ if(lastDigital != readingDigital)
* {
if(readingDigital == HIGH && previous == LOW && millis() - time > debounce)
{
controlChange(channel, 11, 0);
}else{
controlChange(channel, 11, 127);
}
lastDigital = readingDigital;
}
}
// Send a MIDI control change*

void controlChange(byte channel, byte controller, byte value)
{
* midiMsg(channel+0xB0, controller, value);
}
// Send a general MIDI message*

void midiMsg(byte cmd, byte data1, byte data2)
{
* Serial.print(cmd, BYTE);
Serial.print(data1, BYTE);
Serial.print(data2, BYTE);
}*_

Do you mean four digital inputs or 4 (out of the six) analog inputs? If you have run out of pins, you can use some of the well-known multiplexing techniques to expand the number of inputs.

no I'm not running out of pins, it's when I connect more than 2 pins, either digital or analog, it doesn't read them somehow.

Did you ever figure this out?
It sounds like it would be easy to reproduce. I'm embarking on an arduino midi controller project and looking for the gotchas.

thanks, matt