External control available?
2 posters
Page 1 of 1
External control available?
Hey All,
Some time ago I managed to make a diy loco controller for OpenRails, as there is a web server providing train data, so it was possible to output data to an arduino controller. Is it possible to get the live train/sim data from a running openbve instance, through a similar web/api/etc means?
Some time ago I managed to make a diy loco controller for OpenRails, as there is a web server providing train data, so it was possible to output data to an arduino controller. Is it possible to get the live train/sim data from a running openbve instance, through a similar web/api/etc means?
ghenghis- Posts : 5
Join date : 2018-09-25
Re: External control available?
Most of what you want in an API should be there already- Look into creating an ITrainInputDevice plugin, although this will require you to know a little C#
https://github.com/leezer3/OpenBVE/blob/master/source/OpenBveApi/Interface/Input/InputDevice.cs#L105
For an existing example, look at the included DenshaDeGo! Input or SSanYingInput plugins in the main sim source.
Not tried specifically with an Arduino, but should be easy enough.
https://github.com/leezer3/OpenBVE/blob/master/source/OpenBveApi/Interface/Input/InputDevice.cs#L105
For an existing example, look at the included DenshaDeGo! Input or SSanYingInput plugins in the main sim source.
Not tried specifically with an Arduino, but should be easy enough.
Re: External control available?
Thanks, this looks like an entry point to the puzzle. However, how about -output-, e.g - display train speed?
ghenghis- Posts : 5
Join date : 2018-09-25
Re: External control available?
You're running what's essentially arbitrary code within the plugin.
Just import whatever library you need to communicate with your Arduino.
Something like this for example: https://create.arduino.cc/projecthub/haoming-weng/c-arduino-gui-to-control-the-led-0877f8
Just import whatever library you need to communicate with your Arduino.
Something like this for example: https://create.arduino.cc/projecthub/haoming-weng/c-arduino-gui-to-control-the-led-0877f8
Re: External control available?
Well that cleared things up. Besides C# part, as I'm a python guy. But that means that this is doable, I just need to become a C# expert over the weekend.
ghenghis- Posts : 5
Join date : 2018-09-25
Similar topics
» Joystick control
» OpenBVE Remote Control
» OpenBVE Maximum Speed Control
» Temporary override or add new control when play some trains
» 332 External
» OpenBVE Remote Control
» OpenBVE Maximum Speed Control
» Temporary override or add new control when play some trains
» 332 External
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|