hello,
first i have to say i am a newbie and have bad english
here is my problem, i would like "by example" add this code in simhub (joystick just been added and i know i could use the new analog axis but i need to understand if possible maybe for other stuff like relay on the same arduino )
do i have to add it on the clientdisplay directly or create a library or is there a specific place to add it?
thanks in advance
#define USE_ANALOG_HANDBRAKE #define HandbrakePin 3 int minHandbrake = 100; int maxHandbrake = 300; int lastHandbrakeState; int currentHandbrakeState; int minHandbrakeRead = 1023; int maxHandbrakeRead = 0; #include "Joystick.h" Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_MULTI_AXIS, 4, 0, true, true, false, true, false, false, // pour activé la fonction RxAxis false, false, true, true, false); void setup() { Joystick.setYAxisRange(minHandbrake, maxHandbrake); Joystick.begin(); lastHandbrakeState = analogRead(HandbrakePin); delay(1000); //safety delay to flash the code } void loop() { #ifdef USE_ANALOG_HANDBRAKE currentHandbrakeState = analogRead(HandbrakePin); if (currentHandbrakeState != lastHandbrakeState) { Joystick.setYAxis(currentHandbrakeState); lastHandbrakeState = currentHandbrakeState; } } #endif
hio,
so i found a solution that work but not sure this is the good one...
first i modified the joystick data in displayclientv2
and after i put all the code in SHcustomprotocol without the jostick data and i had to delete the line because made an error
#ifdef USE_ANALOG_HANDBRAKE
the handbrake is reconized and works, just had to do a calibration in the "game controller settings"
hio,
so i found a solution that work but not sure this is the good one...
first i modified the joystick data in displayclientv2
and after i put all the code in SHcustomprotocol without the jostick data and i had to delete the line because made an error
#ifdef USE_ANALOG_HANDBRAKEthe handbrake is reconized and works, just had to do a calibration in the "game controller settings"
Hi, would you mind to elaborate on which part of the joystick data in the displayclientv2 that you modified to make your customprotocol code work as intended?
hi again,
it was to modify the joystick begin line that is not "ON" in displayclient2
but you can allow in the customprotocol that is more easy
see example here