Dear Forum,
I am using serial commands to control an arduino uno. In my program, I wish to turn on patterns of pin outs on or off simultaneously.
I know this can be done by addressing each port using HEX commands which represent the bit levels for each pin
To commumicate with the arduino, I am able to send an integer value which represents the bit levels (on or off) for each pin on a given port.
For example
pin 8 on would send a value of 1
pin 9 on would send a value of 2
pin 8 and 9 on would send a value of 3
pins 8, 9 and 10 would send a value of 7
pins 8-13 on would send a value of 63
etc.
How can I translate these integer values into suitable HEX values that the arduino will recognise?
Thanks,
Nick