howdy, I was not sure where to post this but I am using an Arduino mega2560 and I am trying to connect a 6-position rotary switch as hardware and the data ref for the function of the switch only has knob left and knob right. Any insight on how I could code this properly to make it work would be much appreciated. (for reference this is the code I have that made sense but I am new to this so probably not correct. position 3 is the off position of the switch).
function switch_position_callback(position)
print("Switch position changed to: " .. position)
if position == 0 then
xpl_command("aerobask/test/test_lt")
end
if position == 1 then
xpl_command("aerobask/test/test_lt")
end
if position == 2 then
xpl_command("aerobask/test/test_lt")
end
if position == 4 then
xpl_command("aerobask/test/test_rt")
end
if position == 5 then
xpl_command("aerobask/test/test_rt")
end
end
hw_switch_add("ARDUINO_MEGA2560_B_A4_A5_A6_A7_A8_A9" , 6, switch_position_callback)
ARDUINO MEGA 2560 AND AEROBASK PHENOM 300
Re: ARDUINO MEGA 2560 AND AEROBASK PHENOM 300
You would have to find the dataref for this, so you can write the position to the dataref.