DDC
  • Welcome
    • Introduction
    • Supported hardware
  • 1: Project planning
    • Switch inputs
      • Switch table
      • Direct
      • Shift register
      • Port expander
    • Analog inputs
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
    • Processing and memory
  • 2. Wiring
    • Switch inputs
      • Matrix
      • Direct
      • Shift register
      • Port expander
    • Analog
      • Analog switches
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
  • 3. Coding
    • Essentials
      • 02_Board.ino
      • 08_Joystick
      • 10_TableAndAnalog.ino
        • Switch table
        • Analog channels
      • 30_Switches.ino
    • Peripherals
      • RGB LED
        • Firmware control
          • LED functions
          • Color
          • Brightness
          • Presets
        • SimHub control
      • Digital outputs
        • Setup
        • SimHub control
        • Firmware control
      • PWM / Circuit control
        • Setup
        • Calibrate
        • Switch control
        • Trigger control
      • Shift register
      • I2C devices
        • ADS1115
        • PCA9555
        • CAT24C512
    • Advanced
      • Analog inject
      • Conditional coding
        • Triggers
        • Editors
      • Field placement
      • Presets
        • 31_RunningPresets.ino
        • 32_Presets.ino
        • Example
    • Upload
    • Naming the controller
  • 4. Connect to SimHub
    • LED control
    • Controller settings and properties
      • How to connect?
      • How does it work?
      • How to control it?
      • Property list
  • Switch library
    • Pushbutton
    • Function switches
    • Toggle switches
    • Hat switches
    • Car control functions
      • QuickSwitch
      • BrakeMagic
      • ThrottleHold
      • Handbrake
    • Pedals & paddles
      • Brake/throttle
      • Clutch
      • Bite point & launch
      • Filtered curves
      • Shifter
    • Funky switch
      • Directional
      • Center push
    • Encoders
      • rotary2Bit
      • rotary4Bit
      • funkyRotary
      • wildEncoder
      • E18
      • rotaryPulse
      • PEC11
    • Rotary switches
      • rotaryAnalog
      • quickRotary
      • SW1
      • Editing functions
    • Multiswitch complexes
      • Hybrid rotary
      • Multifunction rotary
      • Modded encoder
      • Stacked encoder
    • Preset
    • DDS
    • RGB LED control
    • PWM / Circuit control
    • Utility
  • Fast DDC
    • Buttons and LED
    • 4 encoders, buttons and LED
    • Dual clutches, 4 encoders, buttons and LED
    • Dual clutches, 6 encoders, button matrix and LED
  • CB1
    • Ordering
      • Order together
      • Order yourself
        • 1. Open in EasyEDA
        • 2. Export files
        • 3. Edit Pick&Place
        • 4. Pin headers and jumper
        • 5. Order from JLCPCB
    • Wiring
    • Code
      • Essentials
      • Complete project
      • Settings
    • Circuit
    • Shields
      • Robin
  • Collaboration
Powered by GitBook
On this page
  1. Switch library
  2. Encoders

rotary4Bit

Previousrotary2BitNextfunkyRotary

Last updated 2 years ago

Encoder functions in the rotary4Bit category. Information on this category

rotary4Inc()

Standard incremental encoder setup. Rotating CW will give a button pulse, rotating CCW will give a button pulse with a button number 1 value higher.

void rotary4Inc(int row, int column, bool reverse)

For an encoder on row 1, columns 2-5:rotary4Inc(1, 2, false);

The button numbers used is determined by the number written in the block for the 1st pin. 2nd to 4th pin block will not be read. If button number was set to 15, the switch will use buttons 15 and 16. The reverse part of the function will switch the button numbers if set to true.

  • 2 button numbers

rotary4Modes()

Setup with several switch modes, including a You can set the amount of positions of the hybrid switch to any number.

Modes:

  • 0: 16 - position switch (absolute)

  • 1: Incremental (similar to rotary4Inc())

  • 2: Open hybrid, X positions

  • 3: Closed hybrid

Uses the rotary field for Since is has 4 modes it uses 2 slots in the field.

void rotary4Modes(int row, int column, int fieldPlacement, int hybridPositions, bool reverse)

For a encoder on row 1 column 2-5 -> rotary4Modes(1,2,2,13,true);

  • Field placement to 2. Uses two slots in the bit field (2 and 3). So [DahlDesign.DDCR2] and [DahlDesign.DDCR3] and will show the modes.

  • Hybrid switch has 13 positions. The starting number of the 16-position mode and hybrid switch is determined by the number set in the block for encoder 1st pin. The number for incremental mode is determined by the number set in the block for encoder 2nd pin. So "10" in 1st pin block will give numbers 10-25 for the 16-position switch, and numbers 10-22 for the hybrid switch. "26" in 2nd pin block will give numbers 26 and 27 for incremental mode.

  • 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.

  • 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 16, determined by the highest amount of switch positions in any mode.

  • Two slots in the rotary field.

rotary4Multi()

A counting multiposition switch. You can set the amount of positions to any number. The physical position of the switch will not be in sync with button number.

void rotary2Multi(int row, int column, int positions, bool reverse)

For a encoder on row 2 column 2-5 -> rotary4Multi(2,2,9,false);

  • This will make a 9-position switch. Starting number is the number set in the block for encoder 1st pin.

  • The reverse refers to increasing/decreasing button number on CW/CCW rotation, can be flipped by setting to true.

  • X button numbers.

rotary4Multis()

Switch with several multiposition modes, including a 16-position switch and 3 instances of rotary4Multi().

Modes:

  • 0: 16-position switch. Absolute.

  • 1: Counting multiposition switch, any amount of positions.

  • 2: Counting multiposition switch, any amount of positions.

  • 3: Counting multiposition switch, any amount of positions.

Uses the rotary field for Since is has 4 modes it uses 2 slots in the field.

void rotary4Multis(int row, int column, int fieldPlacement, int positions1, int positions2, int positions3, bool reverse)

For a encoder on row 2 column 2-5 -> rotary4Multis(2,2,2,8,12,18,true);

  • Mode 1 -> 8 position switch

  • Mode 2 -> 12 position switch

  • Mode 3 -> 18 position switch

  • The starting number is determined by the number set in the block for encoder 1st pin.

  • Field placement to 2. Uses two slots in the bit field (2 and 3). So [DahlDesign.DDCR2] and [DahlDesign.DDCR3] and will show the modes.

  • This switch has "reverse" set to true, which can be a good idea if it is placed horizontally on the left side. Turning it CCW will now increase the count instead of reducing.

  • X button numbers, minumum 16. Determined by the highest number of positions used.

  • modButton() to change switch modes.

  • Two slots in the rotary field.

field placement.
field placement.
here.
hybrid switch.