Arduino program to control 1 pole 12 pin rotary switch

Hi...i am new to this forum, suggest me some coding, i am using Arduino uno and 1 pole 12 pin rotary switch. The problem is, I connected the rotary switch to Arduino DIO pin and get the input from rotary switch position change and print those position on serial monitor based on rotary position change..please suggest some coding...

Connect the common contact of the switch to GND. Connect each of the 12 contact to its own Arduino pin but do not use pins 0 or 1.

Use pinMode() to set each contact pin as INPUT_PULLUP. If any of the pins have a state of LOW then the switch is in that position

Use an array to hold the pin numbers and a for loop to set their pinMode() and to read their state using digitalRead()

What switch? please post a link to the data sheet.

If you only want to use a single Arduino pin, then you could add additional resistors and create a voltage divider circuit to use like this...

Then connect to an analog input.

2 Likes

What exactly is a
1 pole 12 pin rotary switch?

1 pole 12 pin seems to somehow contradictory

does it have 1 pole / pin or 12 pins / poles ???

Can you post a schematic of how contacts switch between opened closed?

This is the image of rotary switch
download

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.