ARDUINO MEGA 2560 AND AEROBASK PHENOM 300

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Post Reply
Message
Author
THE KRR
Posts: 1
Joined: Wed Feb 14, 2024 3:44 pm

ARDUINO MEGA 2560 AND AEROBASK PHENOM 300

#1 Post by THE KRR »

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)

User avatar
Ralph
Posts: 8357
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: ARDUINO MEGA 2560 AND AEROBASK PHENOM 300

#2 Post by Ralph »

You would have to find the dataref for this, so you can write the position to the dataref.

Post Reply