Hi
I have 4 thumbwheel switches so that I can choose any number between 0000 and 9999 and
their output is in binary coded decimal.
I wish to read this binary number and use it to set the value of a variable called Pulses which will then drive a stepper motor driver
The ultimate aim is to be able to send a string of pulses to the stepper motor and the number of pulses can be anything between o and 9999
Driving the stepper is not a problem , i know how to do that, but assigning the variable 'pulses' with the number set by the switches has got me scratching my head
I could use a large arduino like the mega and just assign all the switches 16 outputs to 16 input pins , but I want to keep this as small as I can so obviously I need to read each decade one at a time so that I only need 4 input pins
I could use four , 1 of 4 line demultiplexers like the 74HC139 bringing the number of inputs to 4
Lets say I assign each of these 4 possible inputs to a variable 'units' , 'tens' , 'hundreds' , 'thousands'
Now is where I get stuck , I assume I need to
convert each of these 4 variables which are in binary to decimal numbers
and then I need to join the 4 seperate decimal numbers up to make a 4 decade single number
How do I code to do this ? or is there a better way
Regards
Don
