Go Down

Topic: ez expander (Read 280 times) previous topic - next topic

costiflex

hello,

i would like to do this program

Code: [Select]
int led[14] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; // Assign the pins for the leds
int leftChannel = 0;  // left channel input
int left, i;

void setup()
{
for (i = 0; i < 14; i++)  // Tell the arduino that the leds are digital outputs
  pinMode(led[i], OUTPUT);
//  Serial.begin(9600); // Uncomment to enable troubleshooting over serial.
}

void loop()
{
left = analogRead(leftChannel);  // read the left channel
// Serial.println(left);  // uncomment to check the raw input.
left = left / 50;    // adjusts the sensitivity 
//  Serial.println(left);  // uncomment to check the modified input.
// left = 1500;  // uncomment to test all leds light.
// left = 0;    // uncomment to check the leds are not lit when the input is 0.

  if (left == 0)  // if the volume is 0 then turn off all leds
   {
   for(i = 0; i < 14; i++)
     {
     digitalWrite(led[i], LOW);
     }
  }
 
  else
  {
   for (i = 0; i < left; i++) // turn on the leds up to the volume level
    {
     digitalWrite(led[i], HIGH);
    }
   
    for(i = i; i < 14; i++)  // turn off the leds above the voltage level
     {
      digitalWrite(led[i], LOW);
     }
  }
}



but with more outputs

so i have bought an ez-expander.

but i don't know how to use it


can you help me to do the program please ; )

costiflex

for summary

i would to do this :


Go Up