ive decided to play around with the Pi GPIO to use a button (rotary encode button push). However im not getting very far at all.
The code below works well in the AM editor and i can simulate the pushhbutton in the editor but once ive sent it to the pi i just cannot get it to work. I followed the tutorials here https://siminnovations.com/wiki/index.p ... n_tutorial and still no joy.
Code: Select all
function callback_functionBatt(status)
end
-- Callback function which is called when the button is pressed
function button_pressed()
xpl_command("sim/electrical/battery_1_toggle")
end
-- Create a button with the name 'Battery Toggle'
hw_button_add("Battery Toggle", button_pressed)
xpl_dataref_subscribe("sim/cockpit2/electrical/battery_on","INT[8]", callback_functionBatt)
Am i missing something fundamental? Is there something you have to do on teh Pi to enable GPIO use that ive missed?
Cheers Hugh