Hello,
I'm trying to follow this thread and update the teensy plugin so I can have more than 12 commands going with my teensy LC. Are there instruction on how to do this or a video? I have limited knowllege but I can figure it out with a little help.
I'm using a MAC BOOK Pro. This is the program that I'm running on the teensy. I can get everything to up to pin 10 to work but thats it.
#include <Encoder.h>
#include <Bounce.h>
enum INPUT_PINS {
SOFF = 0,
RMAG = 1,
LMAG = 2,
BOTH = 3,
SSTART = 4,
ALT = 5,
BAT = 6,
PUMP = 7,
BEACON = 8,
LNDLGT = 9,
TLGT = 10,
NLGT = 11,
SLGT = 12,
HEAT = 13,
AVI = 14,
ALTAIR = 15,
LGTTEST = 16,
FUP = 17,
F10 = 18,
F20 = 19,
FFULL = 20,
FUEL = 21,
BRAKE = 22,};
void setupInput () {
pinMode (SOFF, INPUT_PULLUP);
pinMode (RMAG, INPUT_PULLUP);
pinMode (LMAG, INPUT_PULLUP);
pinMode (BOTH, INPUT_PULLUP);
pinMode (SSTART, INPUT_PULLUP);
pinMode (ALT, INPUT_PULLUP);
pinMode (BAT, INPUT_PULLUP);
pinMode (PUMP, INPUT_PULLUP);
pinMode (BEACON, INPUT_PULLUP);
pinMode (LNDLGT, INPUT_PULLUP);
pinMode (TLGT, INPUT_PULLUP);
pinMode (NLGT, INPUT_PULLUP);
pinMode (SLGT, INPUT_PULLUP);
pinMode (HEAT, INPUT_PULLUP);
pinMode (AVI, INPUT_PULLUP);
pinMode (ALTAIR, INPUT_PULLUP);
pinMode (LGTTEST, INPUT_PULLUP);
pinMode (FUP, INPUT_PULLUP);
pinMode (F10, INPUT_PULLUP);
pinMode (F20, INPUT_PULLUP);
pinMode (FFULL, INPUT_PULLUP);
pinMode (FUEL, INPUT_PULLUP);
pinMode (BRAKE, INPUT_PULLUP);
}
Bounce soff = Bounce (SOFF, 5);
Bounce rmag = Bounce (RMAG, 5);
Bounce lmag = Bounce (LMAG, 5);
Bounce both = Bounce (BOTH, 5);
Bounce sstart = Bounce (SSTART, 5);
Bounce alt = Bounce (ALT, 5);
Bounce bat = Bounce (BAT, 5);
Bounce pump = Bounce (PUMP, 5);
Bounce beacon = Bounce (BEACON, 5);
Bounce lndlgt = Bounce (LNDLGT, 5);
Bounce tlgt = Bounce (TLGT, 5);
Bounce nlgt = Bounce (NLGT, 5);
Bounce slgt = Bounce (SLGT, 5);
Bounce heat = Bounce (HEAT, 5);
Bounce avi = Bounce (AVI, 5);
Bounce altair = Bounce (ALTAIR, 5);
Bounce lgttest = Bounce (LGTTEST, 5);
Bounce fup = Bounce (FUP, 5);
Bounce f10 = Bounce (F10, 5);
Bounce f20 = Bounce (F20, 5);
Bounce ffull = Bounce (FFULL, 5);
Bounce fuel = Bounce (FUEL, 5);
Bounce brake = Bounce (BRAKE, 5);
FlightSimCommand genOn;
FlightSimCommand genOff;
FlightSimCommand batOn;
FlightSimCommand batOff;
FlightSimCommand pumpOn;
FlightSimCommand pumpOff;
FlightSimCommand beaconOn;
FlightSimCommand beaconOff;
FlightSimCommand lndlgtOn;
FlightSimCommand lndlgtOff;
FlightSimCommand tlgtOn;
FlightSimCommand tlgtOff;
FlightSimCommand nlgtOn;
FlightSimCommand nlgtOff;
FlightSimCommand slgtOn;
FlightSimCommand slgtOff;
FlightSimCommand heatOn;
FlightSimCommand heatOff;
FlightSimCommand aviOn;
FlightSimCommand aviOff;
FlightSimCommand lgttestOn;
FlightSimCommand brakeOn;
void setup() {
setupInput();
genOn = XPlaneRef("sim/electrical/generator_1_on");
genOff = XPlaneRef("sim/electrical/generator_1_off");
batOn = XPlaneRef("sim/electrical/battery_1_on");
batOff = XPlaneRef("sim/electrical/battery_1_off");
pumpOn = XPlaneRef("sim/fuel/fuel_pump_1_on");
pumpOff = XPlaneRef("sim/fuel/fuel_pump_1_off");
beaconOn = XPlaneRef("sim/lights/beacon_lights_on");
beaconOff = XPlaneRef("sim/lights/beacon_lights_off");
lndlgtOn = XPlaneRef("sim/lights/landing_lights_on");
lndlgtOff = XPlaneRef("sim/lights/landing_lights_off");
tlgtOn = XPlaneRef("sim/lights/taxi_lights_on");
tlgtOff = XPlaneRef("sim/lights/taxi_lights_off");
nlgtOn = XPlaneRef("sim/lights/nav_lights_on");
nlgtOff = XPlaneRef("sim/lights/nav_lights_off");
slgtOn = XPlaneRef("sim/lights/strobe_lights_on");
slgtOff = XPlaneRef("sim/lights/strobe_lights_off");
heatOn = XPlaneRef("sim/ice/pitot_heat0_on");
heatOff= XPlaneRef("sim/ice/pitot_heat0_off");
aviOn= XPlaneRef("sim/systems/avionics_on");
aviOff = XPlaneRef("sim/systems/avionics_off");
lgttestOn= XPlaneRef("sim/annunciator/test_all_annunciators");
brakeOn = XPlaneRef("sim/flight_controls/brakes_toggle_regular");}
void loop() {
FlightSim.update();
soff.update();
lmag.update();
both.update();
sstart.update();
alt.update();
bat.update();
pump.update();
beacon.update();
lndlgt.update();
tlgt.update();
nlgt.update();
slgt.update();
heat.update();
avi.update();
altair.update();
lgttest.update();
fup.update();
f10.update();
f20.update();
ffull.update();
fuel.update();
brake.update();
if (alt.fallingEdge() ) {
genOn.once(); }
if (alt.risingEdge() ) {
genOff.once();}
if (bat.fallingEdge() ) {
batOn.once();}
if (bat.risingEdge() ) {
batOff.once();}
if (pump.fallingEdge() ) {
pumpOn.once(); }
if (pump.risingEdge() ) {
pumpOff.once();}
if (beacon.fallingEdge() ) {
beaconOn.once();}
if (beacon.risingEdge() ) {
beaconOff.once();}
if (lndlgt.fallingEdge() ) {
lndlgtOn.once();}
if (lndlgt.risingEdge() ) {
lndlgtOff.once();}
if (tlgt.fallingEdge() ) {
tlgtOn.once();}
if (tlgt.risingEdge() ) {
tlgtOff.once();}
if (nlgt.fallingEdge() ) {
nlgtOn.once();}
if (nlgt.risingEdge() ) {
nlgtOff.once();}
if (slgt.fallingEdge() ) {
slgtOn.once();}
if (slgt.risingEdge() ) {
slgtOff.once();}
if (heat.fallingEdge() ) {
heatOn.once();}
if (heat.risingEdge() ) {
heatOff.once();}
if (avi.fallingEdge() ) {
aviOn.once();}
if (avi.risingEdge() ) {
aviOff.once();}
if (lgttest.fallingEdge() ) {
lgttestOn.once();}
if (lgttest.risingEdge() ) {
lgttestOn.once();}
if (brake.fallingEdge() ) {
brakeOn.once();}
if (brake.risingEdge() ) {
brakeOn.once();}
}