rotaryAnalog
All rotaryAnalog functions are for 12-position switches. The most common are 8, 10, 12 and 16 positions - with 12 being the most common. These functions can be edited without too much hassle to match larger numbers of positions.
For fewer than 12 positions, simply use a dummy value for the unused positions, a value the switch will never be close to reaching. For instance:
rotaryAnalogSimple(2, 58, 209, 342, 462, 565, 680, 848, 1023, 10000, 10000, 10000, 10000, false);
Here, a 8 position switch is used, and the last 4 positions are given the value "10 000".
All rotary switch functions require you to read out the voltage comming from the switch in all its positions. The one exception is rotaryAnalog2ModeShort(), which is a version of rotaryAnalog2Mode (the most used rotary switch function) that will assume the voltages in the 12 positions of the swich. This makes the function a lot easier to use.
rotaryAnalog()
Setup with several switch modes, including a hybrid switch. You can set the amount of positions of the hybrid switch to any number.
Modes:
0: 12-position switch. Absolute.
1: Incremental
2: Open hybrid, X positions
3: Closed hybrid
Uses the rotary field for field placement. Since is has 4 modes it uses 2 slots in the field.
void rotaryAnalog(int analogChannel, int fieldPlacement, int hybridPositions, int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9, int pos10, int pos11, int pos12, bool reverse)
Switch setup with explainations:
rotaryAnalog(
2, <- analog channel
1, <- placement in rotary field
7, <- Switch positions in hybrid mode
16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, <- Switch position values
false); <- Direction is not reversed, so CW rotation increasese button number.
Field placement to 1. Uses two slots in the bit field (1 and 2). So [DahlDesign.DDCR1] and [DahlDesign.DDCR2] and will show the modes.
Hybrid switch has 7 positions. The starting number of the hybrid switch and 12-position mode is determined by the number set in the block for
analogButtonNumber[]. The number for incremental mode is determined by the number set in the block foranalogButtonNumberIncMode[].This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the right side. Turning it CCW will now increase the count instead of reducing.
So typed out in 30_Switches.ino:
rotaryAnalog(2, 1, 7, 16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, false);
modButton() if you want to change modes freely. modButton() not needed to change modes across presets.
hybridButton() to lock position and use rotary as incremental switch.
X button numbers, minimum 12, determined by the largest number of positions in any mode.
Two slots in the rotary field.
rotaryAnalogSimple()
12 - position switch. Absolute.
void rotaryAnalogSimple(int analogChannel, int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9, int pos10, int pos11, int pos12, bool reverse)
Switch setup with explainations:
rotaryAnalogSimple(
2, <- analog channel
16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, <- Switch position values
false); <- Direction is not reversed, so CW rotation increasese button number.
The starting number of the 12-positions is determined by the number set in the block for
analogButtonNumber[].This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the right side. Turning it CCW will now increase the count instead of reducing.
So typed out in 30_Switches.ino:
rotaryAnalogSimple(2, 16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, false);
12 button numbers
rotaryAnalogMute()
12 - position switch. Absolute.
Produces no button presses, but the position of the switch is still detected by the firmware and can be used for conditional coding or rotaryInject.
void rotaryAnalogMute(int analogChannel, int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9, int pos10, int pos11, int pos12, bool reverse)
Switch setup with explainations:
rotaryAnalogMute(
2, <- analog channel
16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, <- Switch position values
false); <- Direction is not reversed, so CW rotation increasese button number.
This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the right side. Turning it CCW will now increase the count instead of reducing. So typed out in 30_Switches.ino:
rotaryAnalogMute(2, 16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, false);
None
rotaryAnalogPartial()
12 - position switch. Absolute.
Mix between rotaryAnalogSimle() and rotaryAnalogMute(). You can select a range of positions which will be muted. The remaining positions will produce a button press. The position of the switch is still detected in the muted positions and can be used for conditional coding or rotaryInject.
void rotaryAnalogPartial(int analogChannel, int muteStart, int muteEnd, int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9, int pos10, int pos11, int pos12, bool reverse)
Switch setup with explainations:
rotaryAnalogPartial(
2, <- analog channel
5, <- The first position in the muted range
9, <- The last position in the muted range
16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, <- Switch position values
false); <- Direction is not reversed, so CW rotation increasese button number.
The starting number of the 12-positios is determined by the number set in the block for
analogButtonNumber[]. In the example above, positions 5, 6, 7, 8 and 9 are muted. The button numbers used will not automatically compress, there will be unused button numbers in the middle of the switch range.This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the right side. Turning it CCW will now increase the count instead of reducing. So typed out in 30_Switches.ino:
rotaryAnalogPartial(2, 5, 9, 16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, false);
12 button numbers
rotaryAnalog2Mode()
Setup with 2 switch modes.
Modes:
0: 12 - position switch. Absolute.
1: Incremental
Uses the rotary field for field placement. Since is has 2 modes it uses 1 slot in the field.
void rotaryAnalog2Mode(int analogChannel, int fieldPlacement, int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9, int pos10, int pos11, int pos12, bool reverse)
Switch setup with explainations:
rotaryAnalog2Mode(
2, <- analog channel
1, <- placement in rotary field
16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, <- Switch position values
false); <- Direction is not reversed, so CW rotation increasese button number.
Field placement to 1 in the rotary field, so [DahlDesign.DDCR1] will show the modes.
The starting number of the 12-position mode is determined by the number set in the block for
analogButtonNumber[]. The number for incremental mode is determined by the number set in the block foranalogButtonNumberIncMode[].This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the right side. Turning it CCW will now increase the count instead of reducing.
So typed out in 30_Switches.ino:
rotaryAnalog2Mode(2, 1, 16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, false);
modButton() if you want to change modes freely. modButton() not needed to change modes across presets.
Minimum 12 button numbers.
One slot in the rotary field.
rotaryAnalog2ModeShort()
Setup with 2 switch modes. This funtion does not require you to record any values from your switch to set up.
Modes:
0: 12 - position switch. Absolute.
1: Incremental
Uses the rotary field for field placement. Since is has 2 modes it uses 1 slot in the field.
void rotaryAnalog2ModeShort(int analogChannel, int fieldPlacement, bool reverse)
Switch setup with explainations:
rotaryAnalog2ModeShort(
2, <- analog channel
1, <- placement in rotary field
false); <- Direction is not reversed, so CW rotation increasese button number.
Field placement to 1 in the rotary field, so [DahlDesign.DDCR1] will show the modes.
The starting number of the 12-position mode is determined by the number set in the block for
analogButtonNumber[]. The number for incremental mode is determined by the number set in the block foranalogButtonNumberIncMode[].This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the right side. Turning it CCW will now increase the count instead of reducing.
So typed out in 30_Switches.ino:
rotaryAnalog2ModeShort(2, 1, false);
modButton() if you want to change modes freely. modButton() not needed to change modes across presets.
Minimum 12 button numbers.
One slot in the rotary field.
rotaryAnalogBite()
Setup with 2 switch modes. Identical to rotaryAnalog2Mode(), but with the option to set the bitepoint together with a biteButton().
Modes:
0: 12 - position switch. Absolute.
1: Incremental
Uses the rotary field for field placement. Since is has 2 modes it uses 1 slot in the field.
void rotaryAnalogBite(int analogChannel, int fieldPlacement, int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9, int pos10, int pos11, int pos12, bool reverse)
Switch setup with explainations:
rotaryAnalog2Mode(
2, <- analog channel
1, <- placement in rotary field
16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, <- Switch position values
false); <- Direction is not reversed, so CW rotation increasese button number.
Field placement to 1 in the rotary field, so [DahlDesign.DDCR1] will show the modes.
The starting number of the 12-position mode is determined by the number set in the block for
analogButtonNumber[]. The number for incremental mode is determined by the number set in the block foranalogButtonNumberIncMode[].This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the right side. Turning it CCW will now increase the count instead of reducing.
So typed out in 30_Switches.ino:
rotaryAnalogBite(2, 1, 16, 107, 200, 291, 383, 474, 566, 657, 749, 841, 932, 1023, false);
modButton() if you want to change modes freely. modButton() not needed to change modes across presets.
Minimum 12 button numbers.
One slot in the rotary field.
biteButton() to set the bite point
Last updated