Hum you are really offroad
for what you are intending digitalWrite should be far enough.
The next step is to toggle the output depending of the game state, and it is where it will fail short, AC does not output the current Light state, so you can't have any feedback
However I've got some progress for custom hardware for the next release , and when the data is available, things like you want to do will be possible
https://github.com/zegreatclan/AssettoCorsaTools/wiki/Custom-Arduino-hardware-support