Arduino array how values are stored, how this think is working

ok is clear enought i got it.

i have one more small problem.

case 0xB it pass the information to the vumeter function,

void vumeter(byte channel, byte number, byte value) {

me i want to make a second function
like this

void vumeter_mainAmplifire(byte channel, byte number, byte value) {

and i will add a button. in voice loop so i can chose witch function to call.

hot to replace the xxxxx for this function please.

void loop() {


  currentState = digitalRead(vu_switch);
  if (currentState != previousState & currentState == LOW) 

  {
    state = !state;
  }
  if (state == 0) {
    xxxxxxxxxxxxxxxxxxx  (vumeter);


  } else {
    xxxxxxxxxxxxxxxxxxxx   (vumeter_mainAmplifire);
  }
  previousState = currentState;
}
void loop() {
  midiEventPacket_t rx = MidiUSB.read();

  switch (rx.header) {

    case 0xB:
      vumeter(
        rx.byte1 & 0xF,  //channel
        rx.byte2,        //cc
        rx.byte3         //value
      );
      break;
  }
}

void vumeter(byte channel, byte number, byte value) {

  int value_ = value;

  if (value_ != ccLastValue) {

    if (channel == VU_MIDI_CH) {

      if (number == 12 ) {

        switch (value_) {
          //led in row 2 are light acording to the case

          case 0:

consider this simple example that uses multiple arrays

const byte AnalogPins [] = { A1, A2, A3 };
#define Nanalog     sizeof(AnalogPins)

int potVals [Nanalog];

// -----------------------------------------------------------------------------
void loop ()
{
    for (unsigned n = 0; n < Nanalog; n++)  {
        potVals [n] = analogRead (AnalogPins [n]);

        Serial.print (" ");
        Serial.print (potVals [n]);
    }
    Serial.println ();

    delay (1000);
}

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

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.