I'm trying to code what I thought was a simple task.
When I flip the momentary switch on my taranis, I want to set Channel 2 on my taranis to max value for a specific time (200ms). I know I can do this woth logical switches and functions, but the script will do some more calculations in future.
This is what I have come up with so far:
local running = false local duration = 20 -- ticks for 1 turn. 1 tick = 10ms local initvalaxis local starttime local function run() -- start movement if not running then running = true starttime = getTime() initvalaxis = getChannelValue(CH2) -- does not exist! end -- move setChannelValue(CH2, 1024) -- does not exist! -- end movement if getTime() >= starttime + duration then running = false setChannelValue(CH2, initvalaxis) -- does not exist! end end return { run=run }I thought I bind this script to a special function to execute when i flip SH and then I'm good to go. BUT: I can't find the commands to get and set current channel values.
Can't function scripts do that? What will I have to use? A mixer script? That scripts are way more complicated :/
Is there a way to set a logical switch from a function or one-time script? this way I could do some calculations and set logical switches accordingly which I could bind to override channels in special functions menu...
Or is there any other _simple_ way I have not thought of yet? or any example scripts which do similar things? Or am I asking for hale in the wrong forum? Where lives all the opentx lua development community?
Thank you in advance