0

When I upload this code LED at pin 13 goes HIGH and that's it. My goal is to make it blink in the order specified in the array. What am I doing wrong?

int Array[] = {1,1,1,0,1,0,0,0,1,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0};
int Data = 13;
int i = 0;

void setup() {
    pinMode(Data, OUTPUT);
}

void loop() {
    int x = Array[i];
    delay(200);
    digitalWrite(Data, x);
    i = i+1;
    if (i==23) {
        i=0;
    }
}
1

What you're doing wrong is living your life at a normal speed.

The LED will be blinking, but so fast you can't see it change.

Without adding some delays in there you will just see the LED light up.

  • Still not working after i added 200ms delay – Arduino Noob Sep 11 '15 at 17:56
  • @ArduinoNoob Please don't edit the solution into your question. Also, if Majenko's answer solved your problem, mark it as accepted by clicking the check mark underneath the answer's score. – NobodyNada Sep 11 '15 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.