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 Answer 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
-
Still not working after i added 200ms delayArduino Noob– Arduino Noob2015年09月11日 17:56:11 +00:00Commented 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.NobodyNada– NobodyNada2015年09月11日 22:07:30 +00:00Commented Sep 11, 2015 at 22:07
lang-cpp