LED Alloy - ARDUINO

Asked

Viewed 53 times

2

Hello, I am a student of electrical engineering and I need to create a code that updates the reference values to light 3 different Leds in all possible combinations, the programming language is for Arduino. I need to implement a function that updates the values of a 3 position vector, currently I am using an array to store the reference values to ascend the leds. Follow the code below.

#define DELAY 1000
int LED[]={13,12,11};   
int i,j;   
int E[][3]={{LOW,LOW,LOW,},
            {LOW,LOW,HIGH},
            {LOW,HIGH,LOW},
            {LOW,HIGH,HIGH},
            {HIGH,LOW,LOW},
            {HIGH,LOW,HIGH},
            {HIGH,HIGH,LOW},
            {HIGH,HIGH,HIGH}};
void setup()
{ 
  for (int m=13; m>10; m--)
   pinMode(m, OUTPUT);
}
void loop()
{
  for(i=0; i<8; i++)
{
  for(j=0; j<3; j++)
   digitalWrite(LED[j], E[i][j]);
   delay(DELAY);
                   }
}
  • And what you want from us?

  • I want you to help me structure this function that updates the positions of this vector.

  • 1

    No longer does it do what you want? Tip: if you list all the numbers from 0 to 7, you’ll have all the sequences from 000 to 111, without doing it manually.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.