Mouse
Mouse control needs two kinds of switches set up:
- Mouse Active button/toggle to enable mouse control momentarily 
- Mouse fuctions that move, click, scroll, etc. as long as mouse control is active. 
1. Mouse active
mouseActiveButton()
Momentary pushbutton, should be assigned a button number. When held, it will open up for other switches to control the mouse cursor.
void mouseActiveButton(int row, int col)
For a switch on row 2 column 4 -> mouseActiveButton(2,4);
- 1 button number 
mouseActiveButtonMute()
Momentary pushbutton, doesn't output any joystick button press. When held, it will open up for other switches to control the mouse cursor.
void mouseActiveButtonMute(int row, int col)
For a switch on row 2 column 4 -> mouseActiveButtonMute(2,4);
- None 
mouseActiveLatch()
Use a momentary pushbutton to toggle "Mouse Active" on/off. Doesn't output any joystick button press. When toggled, will open up for other switches to control the mouse cursor.
The status of the toggle will be sent to the buttonField, allowing you to get SimHub properties indicating if mouse contol is active or not.
void mouseActiveLatch(int row, int col, int fieldPlacement)
For a switch on row 2 column 4 -> mouseActiveLatch(2,4,3);
The toggle status will in this case be on position 3 in the buttonField, propery name [DDC.B3] in SimHub.
- 1 slot in buttonField 
2. Mouse control
leftMouseButton()
Momentary pushbutton. When "Mouse Active", it will work as the left mouse button. Otherwise work like a normal joystick pushbutton.
void leftMouseButton(int row, int col)
For a switch on row 2 column 4 -> leftMouseButton(2,4);
- 1 button number 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
rightMouseButton()
Momentary pushbutton. When "Mouse Active", it will work as the right mouse button. Otherwise work like a normal joystick pushbutton.
void rightMouseButton(int row, int col)
For a switch on row 2 column 4 -> rightMouseButton(2,4);
- 1 button number 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
middleMouseButton()
Momentary pushbutton. When "Mouse Active", it will work as the middle mouse button. Otherwise work like a normal joystick pushbutton.
void middleMouseButton(int row, int col)
For a switch on row 2 column 4 -> middleMouseButton(2,4);
- 1 button number 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
mouseMove()
Momentary pushbutton. Will works as a normal joystick button, but when "Mouse Active" it will move the mouse cursor in the direction and with the speed you set it to. Mouse directions:
- Left: - 1or- MOUSE_LEFT
- Right: - 2or- MOUSE_RIGHT
- Up: - 3or- MOUSE_UP
- Down: - 4or- MOUSE_DOWN
Mouse speed is a value between 1 and 100. This is a very large range of mouse speed, with 1 barely moving and 100 way too fast. This speed is in pixels/second, so large high resolution displays will need higher mouse speed for the same relative speed.
You'll be able to set two mouse speeds; mouseSpeed1 and mouseSpeed2. When holding the button, you'll be at mouseSpeed1 for the first 500 ms, then accelerate to mouseSpeed2 between 500-750 ms, and from 750 ms and out be at mouseSpeed2. This is to allow fine and coarse mouse movement with the same button. If you want a constant speed, just set mouseSpeed1 and mouseSpeed2 to the same value.
void mouseMove(int row, int column, int direction, int mouseSpeed1, int mouseSpeed2)
Setup explained:
void mouseMove(  
int row,                  <— Row for this input
int column,            <— Column for this input
int direction,      <— Direction of mouse movement (1-4, see description tab)
int mouseSpeed1,  <— Initial mouse speed
int mouseSpeed2)   <— Mouse speed after 750 ms of holding the button
For a button on row 2/column 5 moving mouse upwards (MOUSE_UP or 3) with speed 15/25:
mouseMove(2,5,MOUSE_UP,15,25);
- 1 button number 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
rotary2Scroll()
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. When "Mouse Active", it will let you scroll up and down.
void rotary2Scroll(int row, int col, bool reverse)
For an encoder wired to row 4, columns 2 and 3:
rotary2Scroll(4, 2, false);
The "reverse" input is to flip what happens on CW and CCW rotation. Here set to false. Set to true to flip. 
When "Mouse Active", it will let you scroll up/down, reverse it by setting reverse to true. 
- 2 button numbers 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
E18Scroll()
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. When "Mouse Active", it will let you scroll up and down.
void E18Scroll(int row, int col, bool reverse)
For an encoder wired to row 4, columns 2 and 3:
E18Scroll(4, 2, false);
The "reverse" input is to flip what happens on CW and CCW rotation. Here set to false. Set to true to flip. 
When "Mouse Active", it will let you scroll up/down, reverse it by setting reverse to true. 
- 2 button numbers 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
PEC11Scroll()
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. When "Mouse Active", it will let you scroll up and down.
void PEC11Scroll(int row, int col, bool reverse)
For an encoder wired to row 4, columns 2 and 3:
PEC11Scroll(4, 2, false);
The "reverse" input is to flip what happens on CW and CCW rotation. Here set to false. Set to true to flip. 
When "Mouse Active", it will let you scroll up/down, reverse it by setting reverse to true. 
- 2 button numbers 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
funkyMouseButton()
Intended for funky center push button, but will also work for the directional input. When "Mouse Active", it will work as the left mouse button. Otherwise work like a normal joystick pushbutton.
void funkyMouseButton(int row, int column, int pCol, int Col1, int Col2, int Col3)
Fill in the row all the funky pins go to, the column of pushButton and then all the directional buttons.
For a funkyswitch on row 2 with center push on column 5 and the directional inputs on columns 1-4:
funkyMouseButton(2,5,1,2,3,4);
- 1 button number 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
funkyMouseMove()
Intended for funky directional inputs. Will work as a normal joystick button, but when "Mouse Active" it will move the mouse cursor in the direction and with the speed you set it to. Mouse directions:
- Left: - 1or- MOUSE_LEFT
- Right: - 2or- MOUSE_RIGHT
- Up: - 3or- MOUSE_UP
- Down: - 4or- MOUSE_DOWN
Mouse speed is a value between 1 and 100. This is a very large range of mouse speed, with 1 barely moving and 100 way too fast. This speed is in pixels/second, so large high resolution displays will need higher mouse speed for the same relative speed.
You'll be able to set two mouse speeds; mouseSpeed1 and mouseSpeed2. When holding the button, you'll be at mouseSpeed1 for the first 500 ms, then accelerate to mouseSpeed2 between 500-750 ms, and from 750 ms and out be at mouseSpeed2. This is to allow fine and coarse mouse movement with the same button. If you want a constant speed, just set mouseSpeed1 and mouseSpeed2 to the same value. 
void funkyMouseMove(int row, int column, int pCol, int Col1, int Col2, int Col3, int direction, int mouseSpeed1, int mouseSpeed2)
Setup explained:
void funkyMouseMove(  
int row,                  <— Row for  the funky switch
int column,            <— Column for this input
int pCol,                <— Column for center push button
int Col1,                <— Column for the other 3 directional inputs
int Col2,  
int Col3,  
int direction,      <— Direction of mouse movement (1-4, see description tab)
int mouseSpeed1,  <— Initial mouse speed
int mouseSpeed2)   <— Mouse speed after 750 ms of holding the button
For a funkyswitch on row 2 with center push on column 5 and the directional inputs on columns 1-4, moving mouse upwards (MOUSE_UP or 3) with speed 15/25:
funkyMouseMove(2,5,1,2,3,4,MOUSE_UP,15,25);
- 1 button number 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
funkyMouseScroll()
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. When "Mouse Active", it will let you scroll up and down.
void funkyMouseScroll(int Arow, int Acol, int Bcol, bool reverse)
For an encoder with pins A and B to columns 3 and 4. Common pin to row 2:
funkyMouseScroll(2, 3, 4, false);
The "reverse" input is to flip what happens on CW and CCW rotation. Here set to false. Set to true to flip. 
The button numbers used is determined by the number written in the block for the A pin. B pin block will not be read. If button number was set to 15, the switch will use buttons 15 and 16.
When "Mouse Active", it will let you scroll up/down, reverse it by setting reverse to true. 
- 2 button numbers 
- mouseActive button or MOUSE_ALWAYS_ACTIVE set to 1. 
analogMouse()
Set up a thumb stick to control the mouse cursor. This will require a whole lot of plotting values, since both axis of the switch should be calibrated for center, extreme negative and extreme positive positions. Any pushbutton built into the switch should be programmed with functions like pushButton(), biteButton(), etc., and are not included in this function.
You can read values from your analog channels using the serial monitor.
This switch does not require a mouseActive-button.
void analogMouse (int xChannel, int yChannel, int xLeft, int xMiddle, int xRight, int yUp, int yMiddle, int yDown, int mouseSpeed)
Setup explained:
analogMouse 
(int xChannel,      <— Channel # for x axis
 int yChannel,       <— Channel # for y axis
 int xLeft,             <— Value for x axis pushed left
 int xMiddle,         <— Value for x axis in resting position
 int xRight,           <— Value for x axis pushed right
 int yUp,                 <— Value for y axis pushed up
 int yMiddle,         <— Value for y axis in resting position
 int yDown,             <— Value for y axis pushed down
 int mouseSpeed)   <— Mouse speed (1 - 100)
An analogMouse() set up on analog channels 3 and 4 with mouse speed of 15 could look like this:
analogMouse (3,4,14,510,1020,1018,505,10,15); 
- 2 analog channels 
dualClutchAndMouse()
This is the same as dualClutchCal(), but with mouse control built in.
This is probably the worst way to control the mouse cursor, out of all available options. But if clutch paddles is all you have, this will work fine with some practice!
The idea is that the slave paddle will controll the direction of the mouse movement and the master paddle will controll the mouse speed. So in essence the slave paddle is the steering wheel and the master paddle is the throttle for racing the mouse cursor across the screen.
Mouse features are unlocked by holding/toggling a mouseActive button, or setting MOUSE_ALWAYS_ACTIVE to 1 in 2_Boards.ino.
Clutch features:
4 modes:
0: Static - The slave paddle only reaches bite point, the master paddle goes to 100%
1: Dynamic low - Either paddle alone only reaches bite point, press both together to reach 100%
2: Dynamic high - Either paddle alone reaches 100%. Press both and release one to get to bite point.
3: Brake/throttle - Using the paddles as brake and throttle. Output now changes from joystick X axis to brake/throttle axis.
Changing modes are done by holding the modButton and pressing either paddle all the way in and releasing. If this doesnt work, it is a good indication that your clutch doesnt reach a stable 100% or rest at a stable 0% - which means you should adjust your values.
The function defaults to bits 13 and 14 in the rotary field. Will be returned by SimHub as property [DahlDesign.DDCclutchMode].
With to calibrate the output from your paddles you'll need to set up a clutchCalibrate() button.
void dualClutchAndMouse(int masterAnalogChannel, int slaveAnalogChannel, bool throttleMaster, int mouseSpeed)
Type on the analog channels used, throttleMaster is either true or false. When set to true, you'll use master paddle for throttle and slave for brake, if false it is the opposite. Mouse speed between 1 and 100 where 1 is barely moving and 100 is incredibly sensitive. 
Example:
void dualClutchAndMouse(1, 2, true, 15);
- modButton() to change modes 
- biteButton() or bitePot() to change the pite point. 
- launchButton() if you want 1-handed launches. 
- clutchCalibration() button. 
- Two analog channels 
- Enabling mouse features in 2_Boards.ino 
Last updated