I am new to Arduino programming and am having difficulty using an “if” statement to get a selected numeral to display on an 8 x 8 LED matrix. My code attempt is listed. When I upload and run the display switches between the numerals. What I want to do is display a single numeral selected by the “if” statement. Any help and suggestions will be welcomed.
#include <LedControl.h>
LedControl lc=LedControl(12,11,10,1);
int x = 1;
void setup(){
lc.shutdown(0,false); // power-saving mode on startup
lc.setIntensity(0,15); // Set the brightness to maximum value
lc.clearDisplay(0); // and clear the display
}
void Display() {
/* here is the data for the characters */
byte zero[8]= {0x00,0x18,0x24,0x24,0x24,0x24,0x18,0x00};
byte one[8]= {0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00};
if (x = 0);
{for (int n = 0; n < 8; n++){lc.setRow(0,n,zero[n]);}
delay(2000);}
if (x = 1)
{for (int n = 0; n < 8; n++){lc.setRow(0,n,one[n]);}
delay(2000);}
}
void loop(){
Display();
delay(2000);
}