I don't know how clear the title was, but what i'm trying to achive is the following: I have 3 toggle switches wired up to my arduino as push buttons. It all works well, if i flip the switch the button gets pushed, if i flip it agin, it releases. My problem is that i want to have an emulated keyboard button press each time that the state of the switch has changed, so if i flip the switch up, there is a button press, and release, and if i flip it agin, another push and release. Does anyone know how i could make that happen trough simhub? I'm using an arduino nano, and i know, i hould be using a Pro Micro, or something with HID support, but thats what i have atm. Any help will be appreciated! (sorry if i can't write, im europian)
Hey BlackGhostD5,
I see you posted this 3 months ago, figured it out already?
I might have a solution.
If you answer me, i will share it 😉
@dafre81 Hi! I still have no solution for this, and would be cool to have it work the way i want! You have a solution for this?
first off all, i hope my english is good enough, i'm dutch speaking belgian
second, it would be so nice if simhub simply puts in a toggle switch possibility
As we speak, i'm making a button box for ETS2 using a arduino uno
A simple push button works like this, press it ON, release it OFF
A toggle switch doesn't work that way
you have to think that a toggle switch is actually two buttons; OFF-ON-OFF and ON-OFF-ON
so what i did is lying to simhub and my arduino
SKETCH SETUP
For 1 toggle switch, i make 2 additional buttons, both on the same pin, one normal logic, and one reversed logic
you will see an error because you are using 2 buttons on the same pin, just ignore it
KEYBOARD EMULATION
this is a tricky one
you have to make 2 inputs as wel
when its asking "waiting for input": you go OFF - ON - OFF with your switch
and for the second input you go ON - OFF - ON
for both you use "press type: pressed"
and both assign the same key, example L for lights, just make sure it's the key that you will use in your game
It is just a testing fase, buth so far it seems to work
And it is a little bit tricky so i really hope that simhub comes with a easier solution
i hope this will help you, let me know when it's working, or when you have questions
This worked perfectly !
For all who struggle with setting the Button input to a key ( getting it recognized) - you need to change state of the toggle really quick (as fast as you can), this worked for me after multiple tries.
Thanks for the solution @DaFrE81. I actually think this is a quite easy solution compared to coding the arduino yourself as are some other solutions.