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;
 }
}
Nick Gammon
38.9k13 gold badges69 silver badges125 bronze badges
asked Sep 11, 2015 at 17:51

1 Answer 1

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.

answered Sep 11, 2015 at 17:53
2
  • Still not working after i added 200ms delay Commented Sep 11, 2015 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. Commented Sep 11, 2015 at 22:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.