The primary learning guide for the TRRS Trinkey found here contains a simple sketch both in Arduino and Circuit Python for using the device for switch control access to iOS and some Android devices. Note: Not all Android devices have Switch Control capabilities. Here we will provide an advanced Arduino sketch that allows you to use multiple simultaneous keypresses to add even more functionality. We also demonstrate the use of long and short presses for additional features.
You do not need a display for this application–just the TRRS Trinkey and from 1 to 3 AT Switches. Although you can do switch control with just 1 switch, this tutorial presumes you have at least 2 and preferably 3. Again these switches would be designated LEFT, RIGHT, and SELECT.
You will need an OTG adapter to connect the Trinkey to your iOS or Android device. The software emulates a keyboard and sends keystrokes to your touchscreen device which are interpreted as switch control commands.
Begin by connecting your Trinkey to a computer and upload the sketch found at code/TRRS_Switch_Control
which can be found in the GitHub repository for this project. After you have uploaded the sketch, call up a notepad or word processing application on your computer and select it with your mouse. Then test if the Trinkey is working properly. It should send keystrokes when you press your AT switches.
The LEFT switch will send "l", RIGHT sends "r", and SELECT will send "s". Simultaneously RIGHT and SELECT should send "d" and simultaneously pressing LEFT and SELECT should send "u".
You can modify which switch performs which function by editing the code in code/TRRS_Switch_Control/my_inputs.h
at approximately line 23 which currently reads as follows:
//GPIO pin numbers for pushbuttons. Rearrange these to suit your application #define PREVIOUS PIN_TIP #define SELECT PIN_RING1 #define NEXT PIN_RING2
The left cursor button called PREVIOUS is connected to the TIP of the TRRS Jack, the SELECT is connected to RING1, and the right cursor button called NEXT is connected to RING 2. You can edit these to suit your taste. After editing, save the file and re-upload the software.
Once you have verified that it works, disconnect the Trinkey from your PC and connect it to your touchscreen demise using your OTG adapter. You can call up a notepad application on your device and test the buttons one more time. Then configure your device for switch control. The YouTube video below gives detailed explanations of how to set up switch control on an iOS device in our case an iPad mini. The process is the same for other iPads or iPhones. We do not have access to Android devices to demonstrate that but there should be tutorials available elsewhere.
Text editor powered by tinymce.