I want to take a word variable and put each of three/four digits into separate variables- thousands, hundreds, tens, units with the ultimate goal of flashing an led to visually indicate temperature from a remote sensor - differentiating the numbers with longer pauses between digits and/or different colors. On an 08M . . .
I think I see a way- but doubtless it would be spaghetti code:
divide by 1000, put the result in a byte variable, subtract it from the total number, then divide the remainder by 100 and put that result in another variable, etc..
Is there a more elegant way to do this (or what is the "right" way to do this)?
I think I see a way- but doubtless it would be spaghetti code:
divide by 1000, put the result in a byte variable, subtract it from the total number, then divide the remainder by 100 and put that result in another variable, etc..
Is there a more elegant way to do this (or what is the "right" way to do this)?