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, I am currently 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);
}
}