system
November 22, 2009, 2:30am
1
Hey! I am new to programming the Arduino and would like to convert a three digit integer value into an array[3]
observe the following code:
potVal = analogRead(potPin);
potVal = map(potVal, 0, 1023, 100, 200);
lets say
potVal = 123;
how would I make array[] = {1, 2, 3};
??
Thanks in advance
TeamMCS
November 22, 2009, 2:40am
2
The modulas function should be able to help you. (Math.mod in the Math.h library)
You could also use a bitwise shift but that's probably not required in this instance.
system
November 22, 2009, 5:09am
3
Why do you want each digit in a separate array element? It seems like an odd request and I wonder if there isn't already an easier way to do what you want.