Skip to content

Arduino Leonardo Software for Fuel Selector Switches by Sinan

Notifications You must be signed in to change notification settings

charraeus/Fuel-Cutoff-Switches

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

@tableofcontents

Introduction

The Fuel-Selector-Switches by Sinan's Etsy-Shop are driven by an Sparkfun Pro Micro device which is compatible to an Arduino Leonardo device.
The Arduino Leonardo is recognised by the PC operation system as a game controller with the name Arduino Leonardo. Connected to this Leonardo are two "buttons" which are actuated by the two Fuel Selector Switches.

In the image below both Fuel Selector Switches are set to off.

Controller Properties

Features

  1. Expose only 4 joystick buttons.
  2. Expose these buttons as "Button 0" .. "Button 3".
  3. Do not expose any axis'.
  4. Do not expose any hat switch.
  5. Switch the 4 joystick buttons according to the algorithm below.
    • Fuel Selector Switch #1 is set to on: show joystick button 0 as pressed, otherwise as depressed,
    • Fuel Selector Switch #1 is set to off: show joystick button 1 as pressed, otherwise as depressed,
    • Fuel Selector Switch #2 is set to on: show joystick button 2 as pressed, otherwise as depressed,
    • Fuel Selector Switch #2 is set to off: show joystick button 3 as pressed, otherwise as depressed.
  6. The board in use is a Sparkfun Pro Micro which is compatible to the Arduino Leonardo.
  7. Works with all (flight) simulators which can detect a joystick.

Note: The internal joystick button count starts at zero (0), but in the Windows properties window the count starts with 1.

Note: Microsoft Windows does not recognise the pressed joystick button when the Pro Micro board is plugged into the USB port of the PC. To sync the pysical position of the switches it is necessary to actuate one of the fuel selector switches.

Basic Algorithm

  • Joystick button is pressed:
    1. the Arduino sets the joystick button, which indicates the off-position of the switch to not pressed/inactive/off.
    2. the Arduino sets the joystick button, which indicates the on-position of the switch to pressed/active/on.
  • Joystick button is released:
    1. the Arduino sets the joystick button, which indicates the on-position of the switch to not pressed/inactive/off.
    2. the Arduino sets the joystick button, which indicates the off-position of the switch to pressed/active/on.

Wiring

  1. Fuel Selector Switch #1 is connected to Arduino Pin 3 of Pro Micro board.
  2. Fuel Selector Switch #2 is connected to Arduino Pin 2 of Pro Micro board.

Dependencies

  1. Arduino Joystick Library by Matthew Heironimus
    available on Github.
  2. DynamicHID library by Arduino LLC, modified by Matthew Heironimus
    included in 1.
  3. Hardware: Fuel Selector Switches connected to Pro Micro board:
    • Fuel Selector Switch 1 --> Sparkfun Pro Micro pin 3
    • Fuel Selector Switch 2 --> Sparkfun Pro Micro pin 2

Installation of Libraries for PlatformIO

See here for a detailed description.

  • Open platformio.ini, a project configuration file located in the root of PlatformIO project.
  • Add the following line to the lib_deps option of [env:] section:
    mheironimus/Joystick@^2.1.1
  • Build a project, PlatformIO will automatically install dependencies.