If statement with array doesn't work(Im new)

In setup: I turn 40 into binary.

In Loop I want to blink led but led doesn't blink.

int arr[20];
int dec = 40;

void setup() {
int i = 0, ArrLen;
    if(dec > 0)
        while(dec > 0)
            arr[i] = dec % 2;
            dec = dec / 2;

void loop() {
for(byte i = 0; i < 7; i++){
  else {digitalWrite(D0,LOW);}




Did you forget to do something to D0 in setup?

(NB: this is NOT an installation issue)

1 Like

omg you are my hero <3


Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

That if statement is not necessary. You will get the same result with or without it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.