Sorry to be clear I was trying to find a way to hold the first digit at 1 until the second digit reaches f then back to 0 and increment the first digit to a 2 and so on. Basically counting in hex.
Also another question. In my for loop I used i+1 but if I use i++ this doesn't work for me. What is the difference between i+1 and i++?
Thank you for this explanation I really appreciate the help. Sometimes when your new to something, trying to Google, doesn't always help because your new to it and you don't know exactly what to google and the things you do google are not what your looking for.
I wanted to update this post with my most recent code for any other beginners who might read this in the future. This was the smallest I could make it. I also changed out the uno to a nano. The answer to my question of how I could increment the other digits was found with nested for loops. I never knew this was a thing. After realising this, I was able to study the uses of nested for loops. I tried using various methods including millis() before I found the simple solution. I hope this helps some beginner one day.
Simple, until you really need to do something while the display is running (which is pretty common!). The implementation of nested logic in round robin multitasking is classically difficult. But it can be done. Here are some ideas:
Here is how you implement a for loop using a state machine:
for(i=3; i<6; i++) {<somecode>}
decomposes as the sequence
i=3;
while (i<6) {
<somecode>
i++;
}
For the state machine you would do something like
if (state == INITIALIZE) {
i=3;
state = RUN;
}
else if (state == RUN and i<6) {
<somecode>
i++;
}
else {
state = IDLE;
}
To activate it, you just assert:
state = INITIALIZE;
Or, you can use a switch case statement:
switch (state) {
case:INITIALIZE
i=3;
state = RUN;
break;
case:RUN
if (i<6) {
<somecode>
i++;
}
else
{
state = IDLE;
}
break;
case: IDLE
break;
}
Thank you for the information. Also thanks for the wiring compliment. 21 years doing automotive electrics has made my wiring neat. I'm good with circuits. Just want learn code now.