Bonjour à tous,
j’ai acheté un ez-expander ( http://www.robotshop.com/blindage-ez-expander.html )
afin d’augmenter le nombre de sorties de mon arduino uno.
je voudrais donc savoir comment faire pour “étendre” le programme qui est dans mon arduino dans les nouvelles sorties (du expander).
voici le programme (il fonctionne) dans mon arduino :
int led[10] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; // Assign the pins for the leds
int leftChannel = 0; // left channel input
int left, i;
void setup()
{
for (i = 0; i < 10; 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) // si le volume = 0 then éteindre ttes les leds
{
for(i = 0; i < 10; i++)
{
digitalWrite(led[i], LOW);
}
}
else
{
for (i = 0; i < left; i++) // allume les leds en fonction du niveau du volume
{
digitalWrite(led[i], HIGH);
}
for(i = i; i < 10; i++) // éteind les leds en fonction du niveau de voltage
{
digitalWrite(led[i], LOW);
}
}
}
Suffit il d’ajouter le numero des nouvelles sorties au programme,
faut il programmer le expander (si oui, comment) ?
Merci d avance pour vos réponses.
si vous avez des questions, je suis à vous
bonne soirée.