Controlling an Ardu...
 
Notifications
Clear all

Controlling an Arduino pin from Simhub

4 Posts
2 Users
0 Likes
360 Views
(@excludos)
New Member
Joined: 6 months ago
Posts: 2
Topic starter  

Hey guys! I'm trying to do something I would have thought should be super simple, but am seemingly unable to do: Control an Arduino pin from Simhub. Aka, when I press a keyboard button, a led lights up (pin 13, or any other pin which I can easily connect an led to).

I can see that there's options for attaching screens, displays, shakeits, gauges, etc, and even a PL9823 RGB Led option (Which is so close to being useful, but I can't seem to be able to manually control it from Simhub. It just sits there and flashes), but no option to just "set pin high" on the press of an input. Any ideas? Do I have to create a completely separate script outside of Simhub to do this?


   
Quote
(@dadima)
Active Member
Joined: 2 years ago
Posts: 12
 

Hi. I think this link might give you an ideas. You might need to adjust the code in the ShcustomProtocol.h script to make use of the button and send it to arduino. 

button-to-arduino


   
ReplyQuote
(@excludos)
New Member
Joined: 6 months ago
Posts: 2
Topic starter  

@dadima Thanks for the input! Unfortunately, this does the opposite of what I needed: It's a solution for the Arduino to talk to Simhub. What I needed was a way for Simhub to talk to the Arduino.

Right now, the way I've solved it, is to forego SimHub all together, and instead use a third party script to read the button press and then send a signal to the Ardunio. It's a shame, as it's just another program I now have to remember to run (+JoyToKey to remap the button on the steering wheel to something readable by a windows script). Would have been a lot easier if SimHub was open to a bit more customization


   
ReplyQuote
(@dadima)
Active Member
Joined: 2 years ago
Posts: 12
 

I'm sorry. It's my bad of providing an opposite solution. Maybe you can try to take a look at this post. Not have been tested by the person who posted it, but can be a good start. 

Simhub-to-arduino

Take a look in the read() function, the parkingBreak variable should be set in the simhub binding section(could be under ncalc). Just need to ensure it is terminated with ('\n') at the end of the FlowReadSerialUntil... 

Another things that came up while rethink of the solution is by using shellmacros folder inside simhub-since you mention you're using a third party apps to solve it. 

Here is the link of running ahk(autohotkey) script and makes it readable in simhub. 

Simhub shellmacros


   
ReplyQuote
Share: