No, "0b" is the C binary constant prefix, just as "0x" is the hex constant prefix, and "0" is the octal constant prefix0b00000100 = 810 = 0x08 = 010
I notice that the definitions of the number representations start at '1'. I guess that this is because none of your dice have a zero on them. Nevertheless, it would make your display code more reusable (and exclude a possible source of off-by-one errors) if you started the numbers from '0'. This would enable you to use the number directly as an index into the array.
actually, I ran into that very problem and this is how I fixed it. I originally had "0" at the top of the list, but that was displaying the dice result from 0-Xdice mode instead of 1-Xdice mode. I put "0" at the end, which screwed up my code to display which dice mode you were in, by saying "d1" instead of "d2" or "d9" instead of "d0." (for d10). To fix that, I used the "sevenSegWrite(dValue[state] - 1)" and everything worked out just right.I could have just of easily used sevenSegWrite(Result + 1) but I didn't see that at the time. Once I had it working, I was fairly timid to try and change it again.
I don't have a clue how to take the double digit result of the random function, and correctly display them on the two displays.
should I write the array to define the answer as 0-9 or as 0-20.
At this point, I am absolutely convinced I am over-thinking this issue,
QuoteAt this point, I am absolutely convinced I am over-thinking this issue, More importantly, you are under-doing it: sit in front of your arduino / ide and start coding one step at a time.
should I write the array to define the answer as 0-9 or as 0-20.My highest dice value will be 20, but that can be broken down into 2 and 0 on the display.I am not sure if I need to write a byte value for 10-20, and if so, how would I do that.It seems to me it would be easier to write the array 0-9 and call up the proper byte for each digit on each display.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16