XPRNCTreadmillCommunication 1.29.3
dotnet add package XPRNCTreadmillCommunication --version 1.29.3
NuGet\Install-Package XPRNCTreadmillCommunication -Version 1.29.3
<PackageReference Include="XPRNCTreadmillCommunication" Version="1.29.3" />
<PackageVersion Include="XPRNCTreadmillCommunication" Version="1.29.3" />
<PackageReference Include="XPRNCTreadmillCommunication" />
paket add XPRNCTreadmillCommunication --version 1.29.3
#r "nuget: XPRNCTreadmillCommunication, 1.29.3"
#:package XPRNCTreadmillCommunication@1.29.3
#addin nuget:?package=XPRNCTreadmillCommunication&version=1.29.3
#tool nuget:?package=XPRNCTreadmillCommunication&version=1.29.3
XPRNC Treadmill Communication
NuGet Package for communication with the XPRNC Treadmills
Use The Following as Examples
When creating a new Treadmill object it will connect to the Treadmills local server, or the highest numbered COM port (in direct connect mode). Don't forget to reference the namespace:
using XPRNCTreadmill;
When creating a Treadmill you can specify whether or not to allow this library to automatically control the treadmill with pre-defined gesture controls. Setting enableGestureControls to true will create a Camera object internally that will be checked for updates. You can also specify whether or not to enable the start gesture. Setting enableStartGesture to true will enable this. To create an object of type Treadmill:
Treadmill treadmill=new Treadmill();
Treadmill treadmill=new Treadmill(true);//enable gestures
Treadmill treadmill=new Treadmill(true,true);//also enable the start gesture
To enable and disable the Gesture Controls use the following:
treadmill.EnableGestureControl=true;
To Prevent accidental machine motion you may decide to disable the Start Gesture. To enable and disable the Start Gesture use the following:
treadmill.EnableStartGesture=true;
Speed and Angle Commands
Get Speed:
var speed=treadmill.Speed;
Set Speed (to 7 mph):
treadmill.Speed=7;
Get Min Speed. This is defined as the minimum speed above 0mph that the machine can run at:
var minSpeed=treadmill.MinSpeed;
Get Max Speed:
var maxSpeed=treadmill.MaxSpeed;
Get Angle:
var angle=treadmill.Angle;
Set Angle (to 5.3 degrees):
treadmill.Angle=5.3;
Get Min Angle:
var minAngle = treadmill.MinAngle;
Get Max Angle:
var maxAngle = treadmill.MaxAngle;
Machine Statistics
Get Heart Rate if machine is equipped with HRM (BPM)
var hr = treadmill.HeartRate;
Get Cadence if machine is equipped with Cadence Sensor Enable with:
treadmill.EnableIMU = true;
Get Cadence if machine is equipped with Cadence Sensor (Steps/Min)
var cadence = treadmill.Cadence;
Set Cadence Calibration. When set true the machine will calibrate the on board sensor for cadence readings. The machine should be stationary with no movement on the machine when this is called for best results:
treadmill.CadenceCalibration = true;
Get Stride Length. If machine is equipped with Cadence Sensor Get length (feet):
var stride = treadmill.StrideLength;
Get Distance since last power on:
var distance = treadmill.Distance;
Get Uptime since last power on:
var uptime = treadmill.Uptime;
Get Type. This returns the 'Type' of machine being communicated with. This information could be used to target known features on specific 'Types':
var type=treadmill.Type;
Get Serial Number:
var serialNumber=treadmill.SerialNumber;
Machine Modes
Machine modes are the way the treadmill determines its expected actions. Treadmill is the default. When an attachment is added to the machine using the Accessory Port the hardware determines the appropriate Machine Mode.: Get Machine Mode:
Treadmill.MachineModes mode=treadmill.MachineMode;
Attachment Commands
When in wheelchair mode the Set Speed command is disabled. An addition command for turning is added - Get Wheel Chair Angular Velocity. Positive values indicate a turn in the counter-clockwise direction:
var angularVelocity = treadmill.WheelChairAngularVelocity;
If machine is equipped with resistance feedback select auto mode (managed by machine) or manual mode (user defined). Value is true by default. Setting the value to false requires the user to define resistance with Resistance
treadmill.AutoResistance = false;
var autoResistance = treadmill.AutoResistance;
If machine is equipped with resistance feedback this can be used to get/set the resistance in lbs. Set will only work if machine has AutoResistance set to false
treadmill.Resistance = 5.3f;
var resistance = treadmill.Resistance;
Special Commands
Set/Get Ignore Zero Speed. When set to true the machine will bypass safeties that prevent motion at very low speeds. This is reset to false when the machine is power cycled:
treadmill.IgnoreZeroSpeed = true;
Set/Get Ignore Angle Modifier. When set to true this command will ignore safeties that limit the machines max and min angle at high speeds. This is reset to false when the machine is power cycled:
treadmill.IgnoreAngleModifier=true;
Get Direct Connect. Returns true if the class is directly connected to the machine without a middle layer of communication:
var directConnect=treadmill.DirectConnect;
Manual Connection Commands
This library will automatically handle opening and closing connections, but in the event that there is an issue the commands to close or open the connection is as follows: Close Connection:
CloseConnection();
Open Connection:
OpenConnection();
Camera Controls
If you have already created a Treadmill object then you can access camera information with Treadmill.Camera. If you are using the camera tracking without Treadmill object you can call it yourself. When creating a new Camera object it will automatically call StartCamera.
Camera camera = new Camera();
Camera Startup Info
var val = Camera.Started;//will tell you if the camera has been started. will stay true after Camera.Start() until Camera.Stop() is called
var val = Camera.IsInitializing;//will tell you if the camera is still initializing. this is set to false as soon as IsRunning is set true
var val = Camera.IsRunning;//is true when camera is actively running and tracking. will be set false when Camera.Stop() is called. You should wait for this to be false before calling Camera.Start() again
Hand Gestures
Right Hand
Up:
var rightUp = Camera.RightHandUp;
Side:
var rightSide = Camera.RightHandSide;
Select:
var rightSelect = Camera.RightHandSelect;
Left Hand
Up:
var leftUp = Camera.LeftHandUp;
Side:
var leftSide = Camera.LeftHandSide;
Select:
var leftSelect = Camera.LeftHandSelect;
Cursor
Get the cursor position in X,Y (Vector2):
var cursor = Camera.CursorPosition;
Manual Camera Controls
If you would like to manually start the camera you can call this:
camera.Start();
If you would like to manually stop the camera you can call this:
camera.Stop();
Touch Screen Controls
To call a function when a button is pressed on the touch screen use the following:
treadmill.ButtonPressed += Treadmill_ButtonPressed;
Here is an example of a function you can make to hanfle the button press
private void Treadmill_ButtonPressed(int buttonIndex)
{
//DO SOMETHING HERE BASED ON THE BUTTON INDEX
}
To set the text on the buttons by index use the following:
treadmill.SetButtonText(3,"Hello World!");
LEDs
The following commands can be used to control the LEDs on the machine. All commands that take a hex color expect the value without the #
treadmill.LEDSetDefaultBootColor("0000FF");//set the LEDs to fade in solid blue when the machine starts
treadmill.LEDSetSolidDefaultColor();//set the LEDs to solid boot color
treadmill.LEDSetSolidFadeIn("0000FF");//set the LEDs to fade in solid blue. The machine will transition to solid mode automatically after this command completes
treadmill.LEDSolidColor("0000FF");//set the LEDs to solid blue
treadmill.LEDSetSolidFadeOut("0000FF");//set the LEDs to fade out from solid blue. The machine will transition to off mode automatically after this command completes
treadmill.LEDSetRainbow();//set the LEDs to rainbow
treadmill.LEDSetRainbowSparkle();//set the LEDs to rainbow sparkle
treadmill.LEDSetSparkle("0000FF");//set the LEDs to sparkle blue
treadmill.LEDSetFlash("0000FF");//set the LEDs to flash blue
treadmill.LEDSetBreathe("0000FF");//set the LEDs to breathe blue
treadmill.LEDSetConveyor("0000FF",100);//set the LEDs to conveyor blue with 100ms between movements
treadmill.LEDSetCustomBoth({"0000FF","00FF00","FF0000","FFFF00","00FFFF","FF00FF"});//will set the color of specific LEDs on both sides, in this case the first 6 LEDs
treadmill.LEDSetCustomLeft({"0000FF","00FF00","FF0000","FFFF00","00FFFF","FF00FF"});//will set the color of specific LEDs on left side, in this case the first 6 LEDs. This will not block or modify right side
treadmill.LEDSetCustomRight({"0000FF","00FF00","FF0000","FFFF00","00FFFF","FF00FF"});//will set the color of specific LEDs on right side, in this case the first 6 LEDs. This will not block or modify left side
treadmill.LEDSetFlmae();//set the LEDs to flame pattern
int[] LEDcount= GetLEDCount();//returns the number of LEDs
treadmill.LEDSetCustomAll({"0000FF"},{"0000FF"},{"0000FF"},{"0000FF"});//will set the color of specific LEDs on all 4 strips, in this case the first 1 LED.
Tips For Use In Unity
Follow this code as a template/example
using XPRNCTreadmill;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TEST : MonoBehaviour
{
static XPRNCTreadmill.Treadmill treadmill;
// Start is called before the first frame update
[RuntimeInitializeOnLoadMethod]
static void Start()
{
treadmill =new Treadmill();
}
// Update is called once per frame
void Update()
{
}
private void OnApplicationQuit()
{
treadmill = null;
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.SignalR.Client (>= 9.0.3)
- MySql.Data (>= 9.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.IO.Ports (>= 6.0.0)
- System.Numerics.Vectors (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.29.3 | 192 | 10/17/2025 |
| 1.25.14 | 263 | 10/8/2025 |
| 1.25.13 | 205 | 10/7/2025 |
| 1.25.12 | 198 | 10/7/2025 |
| 1.25.11 | 206 | 10/7/2025 |
| 1.25.10 | 201 | 10/6/2025 |
| 1.25.9 | 310 | 8/29/2025 |
| 1.25.8 | 167 | 8/15/2025 |
| 1.25.7 | 237 | 8/14/2025 |
| 1.25.6 | 254 | 8/12/2025 |
| 1.25.5 | 477 | 8/8/2025 |
| 1.25.4 | 285 | 8/7/2025 |
| 1.25.3 | 220 | 7/14/2025 |
| 1.25.2 | 209 | 6/6/2025 |
| 1.25.1 | 302 | 5/20/2025 |
| 1.25.0 | 297 | 5/15/2025 |
| 1.24.15 | 291 | 5/15/2025 |
| 1.24.14 | 277 | 5/15/2025 |
| 1.24.13 | 289 | 5/15/2025 |
| 1.24.9 | 299 | 5/14/2025 |