I copied and pasted the example code:
Code: Select all
setTickRate(30)
function onTick()
local arm = getGpio(0)
local g = getAccel(1)
if arm == 0 then
stopLogging()
end
if arm == 1 and g < 0.1 then
startLogging()
end
end
I then tipped the unit around to exceed the threshold, but did not see the logger come on.
Next I started using the print command to check other functions. getAnalog(7) will give me battery voltage and print it, but getAccel(0) will not return anything. I tried all four getAccel channels with no success.
Ideas?
Also, after pushing changes to the RCP, I have to reset it (pull usb power in this case) to get it to run the updated lua script. Is this normal?
Thanks!
Josh