Hello, I'm new to Arduino programming and I have bought a starter kit from ebay which includes some tutorials. However, currently I'm stuck with the 8 segment display programming part and the codes are:
/*
1 Digital 8-Segment LED Display
Display the number from 1-9
*/
byte Digital[10]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6};//the character code for number 1-9
void setup()
{
int i=2;
for(i=2;i<10;i++)
{
pinMode(i,OUTPUT);
digitalWrite(i,HIGH);
}
}
void loop()
{
int i=0;
int j;
//Display number 1-9
for(i=0;i<10;i++)
{
//for every number, send the character code to the digital pin
for(j=0;j<8;j++)
{
if(Digital[i]&1<<j)
digitalWrite(9-j,LOW);
else
digitalWrite(9-j,HIGH);
}
delay(500);
}
}
My problem is in looping part. I can't grasp on how the program works. I understand on the for and if function, but still can't get how the program works. I would please to like the explaination on the code.