Communicating with the Xenas Gun through USB.
updated 2024-May-25
The Xenas Gun comes with a USB-C port for optional wired connection to a computer. As an Arcade builder, this means you can use Serial communication to interact with the Xenas Gun.
First thing first, Testing if your computer is even capable of interacting with the Xenas Gun.
For Windows PC:
1. Open the 'Device Manager' and expand 'Ports (COM & LPT)', you should see a list of all Serial COM devices attached to your Windows PC.
2. Unplug and plug the Xenas Gun and you will notice one of the COM ports appear and disappear. That's your COM port number.
3. Now open command prompt and type: echo 0xF2 >com# (replace the # with the COM port number).
The Recoil on the Xenas Gun should bang.
4. Congratulations. Now continue to 'Sending commands to the Xenas Gun'.
For Linux:
1. Open the command prompt and navigate to the /dev directory : cd /dev
2. While in the /dev directory, type: dmesg | grep ttyS*
A list of all the Serial devices under tty will display. Look for a device called: cdc_acm 1-1.1.1.1: ttyXXX.
The ttyXXX or whatever it says is the serial location of the Xenas Gun.
3. Now type: echo 0xF2 > ttyXXX (replace the XXX with the actual letters you received in step 2.
4. Congratulations. Now continue to 'Sending commands to the Xenas Gun'.
Using 3rd party applications on Windows & Linux:
1. If you wish to manually open the Serial COM port using other 3rd party applications such as Putty or SerialTerm, use these credentials:
115200 baud rate, No parity, 8 Data bits, 1 stop bit, No hardware flow control.
2. Check if you see the Xenas gun printing out its name every second. If so, you've got the correct COM connected to the Xenas gun. If not, check a different COM or power cycle the Xenas gun and try again.
Now that you've tested and verified serial communication with the Xenas gun, Let's have fun shall we:
Sending commands to the Xenas Gun.
Here's a list of all the commands you can send to the Xenas Gun.
Set the color of the LEDs
(This will only work if the user set their Xenas Gun LED functionality to 'SOFTWARE' controlled mode.)
To set all 3 LEDs to a single color:
In Windows Command prompt or Linux terminal, enter: echo 0xF0 0xFF 0xFF 0xFF > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF0 0xFF 0xFF 0xFF > COM#
How it works:
So the above command example says: 0xF0 0xFF 0xFF 0xFF
Let's break it apart: 0xF0 0xFF 0xFF 0xFF
0xF0 = Tells the Xenas Gun to set the Color of the LEDs
0xFF = Value of the RED hue.
0xFF = Value of the Green hue.
0xFF = Value of the Blue hue.
To set each individual LED to its own color:
In Windows Command prompt or Linux terminal, enter: echo 0xF0 0xFF 0xFF 0xFF 0xF7 0xF7 0xF7 0x00 0x00 0x00 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF0 0xFF 0xFF 0xFF 0xFF 0xF7 0xF7 0xF7 0x00 0x00 0x00 > COM#
How it works:
So the above command example says: 0xF0 0xFF 0xFF 0xFF 0xF7 0xF7 0xF7 0x00 0x00 0x00
Let's break it apart: 0xF0 0xFF 0xFF 0xFF 0xF7 0xF7 0xF7 0x00 0x00 0x00
0xF0 = Tells the Xenas Gun to light up each LED in a separate color.
0xFF 0xFF 0xFF = Color of the first LED. This is the LED closest to the front muzzle. (Change them however you wish).
0xF7 0xF7 0xF7 = Color of the middle LED. (Change them however you wish).
0x00 0x00 0x00 = Color of the last LED. This is the LED closest to the back of the Xenas Gun. (Change them however you wish).
To vibrate the Xenas Gun
(This will only work if the user turned on the Vibration & Haptics for their Xenas Gun)
In Windows Command prompt or Linux terminal, enter: echo 0xF1 0x00 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF1 0x00> COM#
For a haptic sensation
(This will only work if the user turned on the Vibration & Haptics for their Xenas Gun)
To control the Recoil
In Windows Command prompt or Linux terminal, enter: echo 0xF1 0x01 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF1 0x01> COM#
(This will only work if the user set their Xenas Gun Recoil functionality to 'SOFTWARE' controlled mode.)
Test Bang!!
In Windows Command prompt or Linux terminal, enter: echo 0xF2 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF2 > COM#
No Recoil (Send this command to stop the recoil. Typically used when the player runs out of ammo or fires off-screen)
In Windows Command prompt or Linux terminal, enter: echo 0xF2 0x00> COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF2 0x00 > COM#
Single Shot (Send this command to put the recoil in single bang mode. Typically used when the player equips a semi auto pistol)
In Windows Command prompt or Linux terminal, enter: echo 0xF2 0x01> COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF2 0x01> COM#
Auto Shots (Send this command to put the recoil in continuous mode. Typically used when the player equips an auto rifle)
In Windows Command prompt or Linux terminal, enter: echo 0xF2 0x02> COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF2 0x2> COM#
Adjusting to the Display's Bezel
For Full Screen with no bezels:
In Windows Command prompt or Linux terminal, enter: echo 0xF3 0x00 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF3 0x00 > COM#
If there are bezels that reduce your game play to 4:3:
In Windows Command prompt or Linux terminal, enter: echo 0xF3 0x01 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF3 0x01 > COM#
If there are bezels that reduce your game play to 16:9:
In Windows Command prompt or Linux terminal, enter: echo 0xF3 0x02 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF3 0x02 > COM#
To display contents on the LCD Screen
(This will only work if the user set their Xenas Gun LCD Screen functionality to 'HYBRID' or 'SOFTWARE' controlled mode.)
To return to the Xenas Gun home screen:
In Windows Command prompt or Linux terminal, enter: echo 0xF4 0x00 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF1 0x00> COM#
To display Text:
In Windows Command prompt or Linux terminal, enter:
echo 0xF4 0x01 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F "Hello world" > COM#
In your .ahk file, enter:
Run, %COMSPEC% /C echo 0xF4 0x01 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F "Hello world" > COM#
How it works:
So the above command example says: 0xF4 0x01 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F "Hello world"
Let's break it apart: 0xF4 0x01 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F "Hello world"
0xF4 = Tells the Xenas Gun to update the LCD Screen.
0x01 = Means you want to display text.
0xFF 0xFF 0xFF = Red, Green, Blue color of the background. (Change them however you wish)
0x7F 0x7F 0x7F = Red, Green, Blue color of the text. (Change them however you wish).
"Hello world" = The text you wish to display. Your text must be inside double quotation marks. 19 is the maximum characters & white spaces you can have.
To display a Linear bar:
In Windows Command prompt or Linux terminal, enter:
echo 0xF4 0x07 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F 0x00 0x00 0x00 "75" 0x22 0x22 0x22 "Hello" > COM#
In your .ahk file, enter:
Run, %COMSPEC% /C 0xF4 0x07 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F 0x00 0x00 0x00 "75" 0x22 0x22 0x22 "Hello" > COM#
How it works:
So the above command example says: 0xF4 0x07 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F 0x00 0x00 0x00 "75" 0x22 0x22 0x22 "Hello"
Let's break it apart: 0xF4 0x07 0xFF 0xFF 0xFF 0x7F 0x7F 0x7F 0x00 0x00 0x00 "75" 0x22 0x22 0x22 "Hello"
0xF4 = Tells the Xenas Gun to update the LCD Screen.
0x07 = Means you want to display a linear bar.
0xFF 0xFF 0xFF = Red, Green, Blue color of the background. (Change them however you wish)
0x7F 0x7F 0x7F = Red, Green, Blue color of the linear bar boarder. (Change them however you wish).
0x00 0x00 0x00 = Red, Green, Blue color of the linear bar's value. (Change them however you wish).
"75" = The value of the bar. (0% to 100%). Your number must be inside double quotation marks.
0x22 0x22 0x22 = Red, Green, Blue color of optional text. (Change them however you wish).
"Hello" = Optional text you wish to display. Your text must be inside double quotation marks. 9 is the maximum characters & white spaces you can have.
To power cycle the Xenas Gun
In Windows Command prompt or Linux terminal, enter: echo 0xF9 > COM#
In your .ahk file, enter: Run, %COMSPEC% /C echo 0xF9 > COM#