[edit] Polly spotted that the arduino property did need to be set as below (even if it was already 1 on startup) otherwise the gear was down on startup, so the working solution is the code below and it needs to be included in the DC3.nas file. To keep things tidy I'd rather it was in a separate arduino-dc3.nas file that I've created and I've put a path:
<arduino-control>
<file>Aircraft/Douglas-Dc3/Nasal/arduino-DC3.nas</file>
</arduino-control>
in the dc-3-jbsim-cnf.xml but it's not working...
- Code: Select all
setprop("input/arduino/gear-down", 1);
setlistener("input/arduino/gear-down", func(v)
{
if (v.getBoolValue())
{
controls.gearDown(1);
}
else if (v.getBoolValue() == 0 )
{
controls.gearDown(-1);
}
},1,0);