Changing gears via C# application
Hi, I am new to LFS programming and I am building my very own H-shifter as a project for my technology course in college.
It's got to have my own programmed chip in it which will be Arduino. I know how to send the current gear to my C# app, however I don't know how to change the gear in the game if it's possible at all. The "e.gear" in my outgauge library is read-only so I cannot send my own value for a current gear.
Thank you
You need to send a keypress event to Windows to keep the gear selected. This would probably interfere with the chat and other things, so you should check this to stop sending that key.

Another option is to use sequential gearbox, and just send as many keypresses you need to reach the desired gear. This would avoid most of the problems you could have to face.
Quote from danius375 :... however I don't know how to change the gear in the game if it's possible at all.

you can try by changing the memory of the game
There are a few ways how to do this. You can of course simulate a key press which is probably the easiest way but it has the disadvantage of screwing up things both inside and outside LFS.

Changing a byte in memory is NEVER a good idea because there is no way to synchronize the access. Your application might decide to change the value in a middle of some calculation and crash the game or make it go OOS. It'd be even more dangerous if LFS were a multithreaded application. It can do the job in some cases but as a general practice it should be a big no-no.

The most clean solution would be to make your Arduino controller a USB HID device but that itself would be a much greater task that the rest of your project. There are, however, resources on the web with some working protoypes and sample code.

FGED GREDG RDFGDR GSFDG