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. Rotary switches

SW1

PreviousquickRotaryNextEditing functions

Last updated 1 year ago

The SW1 steering wheel has some special features for its 12-position switches. These functions could be useful for other projects as well, which is why they're included in DDC.

SW1BiteRotary()

Modes:

  • 0: 12 - position switch. Absolute.

  • 1: Incremental

This switch uses the same general approach as other switches setting bite point, moving through the 10, 1 and 0.1 increments. However, instead of increasing/decreasing on rotation, the actual position of the switch will determine what the bite point is set to. So if we're in the first step of bite point setting and in position 4, we're setting bite point to 40. In the next step, if switch is in position 8, we're at bite point 48, etc. This way, using the absolute nature of the 12-position switch, we can set a bite point with 0.1% accuracy without any visual feedback other than the switchs' position.

SW1BiteRotary(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:

SW1BiteRotary(

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 for analogButtonNumberIncMode[].

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

SW1BiteRotary(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.

  • quickSwitch() to override position.

  • biteButton() to set bite point.

SW1PresetRotary()

Modes:

  • 0: 12 - position switch. Absolute.

  • 1: Incremental

When powering up the controller, it will start in the preset corresponding to the position of this switch.

SW1PresetRotary(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:

SW1BiteRotary(

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 for analogButtonNumberIncMode[].

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

SW1PresetRotary(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.

  • quickSwitch() to override position.

  • presetButton() to be able to change presets

A switch with 2 modes. Also included in the system. When in 12 - position mode this switchs' position will be overridden by quickSwitch().

Uses the rotary field for Since is has 2 modes it uses 1 slot in the field.

In addition, this switch can set the bite point of your clutches. Works in combination with The button presses will not trigger when setting bite point.

A switch with 2 modes. Also included in the system. When in 12 - position mode this switchs' position will be overridden by quickSwitch().

Uses the rotary field for Since is has 2 modes it uses 1 slot in the field.

In addition, the switch can be used to change presets. When holding a , the position of the switch will determine which preset you're selecting.

quickSwitch
field placement.
quickSwitch
field placement.
biteButton().
presetButton()
The two 12-position switches on SW1 has several features.