Using arrays and for loops is the right way to go because, as you say, your code will get very long without them. And, as already pointed out, LED1 has only 2 indexes. "LED1" is the array and "Pin" is the index into the array. I don't think that was your intention anyway. Those pins are for sketch upload and communicating with serial monitor. This will set pins 0 and 1 to be outputs. ![]() This code will light up the 7 segment LED from A to G 1 by 1Ĭonst int timer=5000 //Sets the delay time One thing I've noticed is that the digits it does give appear to be a combination of the previous and current number of the sequence. If I limit the code to only display one of the numbers individually, it displays it correctly, however if I try a sequence it gives me jumbled rubbish. My issue is that it's not counting correctly. ![]() I can do it fine without using arrays or for statements but it's incredibly long and inefficient code so I found the array and for commands and figured they can do the job. ![]() Just got one of these and learning programming and trying to use a 7-segment LED to count from 1 to 8.
0 Comments
Leave a Reply. |