Quote:
|
Originally Posted by Andy1845c 3. I want to select from 4-6 led patterns with a rotary switch. Is this possible/advisable with a single PIC? I assume I could use 4-6 seperate PICs, one for each pattern, but I am guessing thats not needed. Does anyone have a schematic or link to a similar project so I can get an idea on how this is done? |
The trick is to convert from 1 of n to binary.
The attachment is an extract for one of my designs. I've converted 1 of 10 to binary using a 2 gang rotary switch.
It could be done with a one gang switch by:-
- using more diodes, or
- using a Priority Encoder IC.
In the case of a one gang, 4 position switch (ie. n = 4 ), all you need is 2 diodes and 2 resistors.
But if you use a 4 position, 2 gang switch, all you need is 2 resistors.
EDIT, I mis-read your request. You want 6 LED patterns.
So you can do it with a 2 gang 6 position switch and 3 resistors as per the 0 ~ 5 positions in the attachment,