Problem with if statement controlling 8x8 matrix

garysat:
placed ; after second if statement, still switches between 0 and 1. ?

Now you have two problems at each if statement.

Please use code tags and use auto formatting (Ctrl-T) in IDE for better formatting and much easier to read code.