Hi everyone, this is my first post on this forum so i thought this is the best section to post in. So my apologies if it is not.
This is what i want to make: i want to control the direction of 4 dc motors using an arduino uno. i do that using two L293DNE to control the direction of the 4 dc motors (CW and CCW for specified periods of time). That i already did.
What i want to do more is to set 6 ways the motors will behave using 4 6-way rotary switches (one for each motor).
- motor off
- motor spin CW continuously
- motor spin CCW continuously
- motor spin CW for 3min/hour
- motor spin CCW for 3min/hour
- moro spin CW and CCW (alternate) for 3 min/hour
My question is: Since i don't have 24 digital input pins on my arduino uno i am thinking of using the rotary switch with resistors and connect each rotary switch to an analog input pin.
i did some research on this forum and i saw that i have to connect resistors to every pin on the rotary switch and then read the input through the analog input pin (which will differ because of the resistors)
what i don't know is how do i connect the rotary switch with the resistors to the arduino uno.
My thoughts:
- the common wire (the four pins in the middle of the rotary switch) go to the ground of the arduino
- connect one wire from the first pin of the rotary switch to the +5v pin on the arduino
- connect one wire from the 6th pin of the rotary switch to one analog input pin on the arduino (the one i do the reading from)