Flight Sim Gear Panel Program Help

Hi:

Just learning Arduino and trying this sketch (but getting errors!):

errors include
‘does not name a type’ and ‘was not declared in this scope’

Thanks ahead of time:

Sketch:

#include <Bounce.h>

////////////////////////////////////////
// Hardware input
//
const int gearSwitchPin = 25;
Bounce gearSwitch = Bounce (gearSwitchPin, 5);

////////////////////////////////////////
// Hardware output
//
const int greenLeftPin = 10;
const int greenNosePin = 11;
const int greenRightPin = 12;

const int redLeftPin = 20;
const int redNosePin = 19;
const int redRightPin = 18;

////////////////////////////////////////
// X-Plane input and output
//
// Landing gear handle commands
FlightSimCommand gearUp;
FlightSimCommand gearDown;

// Landing gear actual position
FlightSimFloat gearDeployLeft;
FlightSimFloat gearDeployNose;
FlightSimFloat gearDeployRight;

// Landing gear handle position
FlightSimInteger gearHandleDown;

// Aircraft essential bus voltage
FlightSimFloat supplyVolts;

void setup() {

//////////////////
// Input
//
pinMode (gearSwitchPin, INPUT_PULLUP);

//////////////////
// Output
//
pinMode(greenLeftPin, OUTPUT);
pinMode(greenNosePin, OUTPUT);
pinMode(greenRightPin, OUTPUT);

pinMode(redLeftPin, OUTPUT);
pinMode(redNosePin, OUTPUT);
pinMode(redRightPin, OUTPUT);

//////////////////
// X-Plane
//
gearUp = XPlaneRef(“sim/flight_controls/landing_gear_up”);
gearDown = XPlaneRef(“sim/flight_controls/landing_gear_down”);

gearDeployLeft = XPlaneRef(“sim/flightmodel2/gear/deploy_ratio[1]”);
gearDeployNose = XPlaneRef(“sim/flightmodel2/gear/deploy_ratio[0]”);
gearDeployRight = XPlaneRef(“sim/flightmodel2/gear/deploy_ratio[2]”);

gearHandleDown = XPlaneRef(“sim/cockpit2/controls/gear_handle_down”);

supplyVolts = XPlaneRef(“sim/cockpit2/electrical/bus_volts[0]”);
}

void loop() {

FlightSim.update();
gearSwitch.update();

//////////////////
// Process input
//

// blocking input on gear handle position
if(gearSwitch.read() == LOW) { // if the switch is closed
if (gearHandleDown == 0) { // if gear handle is up
gearDown.once(); // move it down
}
} else {
if (gearHandleDown == 1) { // if gear handle is down
gearUp.once(); // move it up
}
} // gearSwitch

//////////////////
// Process output
//

// we need 10V and the sim to be running to light the LEDs
bool canLight = (supplyVolts > 10.0) && FlightSim.isEnabled();

// light red LEDs if gear handle and position disagree and we have power
digitalWrite(redLeftPin, (gearHandleDown != gearDeployLeft) && canLight);
digitalWrite(redNosePin, (gearHandleDown != gearDeployNose) && canLight);
digitalWrite(redRightPin, (gearHandleDown != gearDeployRight) && canLight);

// light green LEDs if gear down and we have power
digitalWrite(greenLeftPin, (gearDeployLeft == 1.0) && canLight);
digitalWrite(greenNosePin, (gearDeployNose == 1.0) && canLight);
digitalWrite(greenRightPin, (gearDeployRight == 1.0) && canLight);

}

Error messages:

/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:24:1: error: ‘FlightSimCommand’ does not name a type
FlightSimCommand gearUp;
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:25:1: error: ‘FlightSimCommand’ does not name a type
FlightSimCommand gearDown;
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:28:1: error: ‘FlightSimFloat’ does not name a type
FlightSimFloat gearDeployLeft;
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:29:1: error: ‘FlightSimFloat’ does not name a type
FlightSimFloat gearDeployNose;
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:30:1: error: ‘FlightSimFloat’ does not name a type
FlightSimFloat gearDeployRight;
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:33:1: error: ‘FlightSimInteger’ does not name a type
FlightSimInteger gearHandleDown;
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:36:1: error: ‘FlightSimFloat’ does not name a type
FlightSimFloat supplyVolts;
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino: In function ‘void setup()’:
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:59:3: error: ‘gearUp’ was not declared in this scope
gearUp = XPlaneRef(“sim/flight_controls/landing_gear_up”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:59:68: error: ‘XPlaneRef’ was not declared in this scope
gearUp = XPlaneRef(“sim/flight_controls/landing_gear_up”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:60:3: error: ‘gearDown’ was not declared in this scope
gearDown = XPlaneRef(“sim/flight_controls/landing_gear_down”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:62:3: error: ‘gearDeployLeft’ was not declared in this scope
gearDeployLeft = XPlaneRef(“sim/flightmodel2/gear/deploy_ratio[1]”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:63:3: error: ‘gearDeployNose’ was not declared in this scope
gearDeployNose = XPlaneRef(“sim/flightmodel2/gear/deploy_ratio[0]”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:64:3: error: ‘gearDeployRight’ was not declared in this scope
gearDeployRight = XPlaneRef(“sim/flightmodel2/gear/deploy_ratio[2]”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:66:3: error: ‘gearHandleDown’ was not declared in this scope
gearHandleDown = XPlaneRef(“sim/cockpit2/controls/gear_handle_down”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:68:3: error: ‘supplyVolts’ was not declared in this scope
supplyVolts = XPlaneRef(“sim/cockpit2/electrical/bus_volts[0]”);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino: In function ‘void loop()’:
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:73:3: error: ‘FlightSim’ was not declared in this scope
FlightSim.update();
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:82:9: error: ‘gearHandleDown’ was not declared in this scope
if (gearHandleDown == 0) { // if gear handle is up
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:83:7: error: ‘gearDown’ was not declared in this scope
gearDown.once(); // move it down
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:86:9: error: ‘gearHandleDown’ was not declared in this scope
if (gearHandleDown == 1) { // if gear handle is down
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:87:7: error: ‘gearUp’ was not declared in this scope
gearUp.once(); // move it up
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:96:20: error: ‘supplyVolts’ was not declared in this scope
bool canLight = (supplyVolts > 10.0) && FlightSim.isEnabled();
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:99:30: error: ‘gearHandleDown’ was not declared in this scope
digitalWrite(redLeftPin, (gearHandleDown != gearDeployLeft) && canLight);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:99:48: error: ‘gearDeployLeft’ was not declared in this scope
digitalWrite(redLeftPin, (gearHandleDown != gearDeployLeft) && canLight);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:100:48: error: ‘gearDeployNose’ was not declared in this scope
digitalWrite(redNosePin, (gearHandleDown != gearDeployNose) && canLight);
^
/tmp/285443523/GearProgram_Unsub1/GearProgram_Unsub1.ino:101:48: error: ‘gearDeployRight’ was not declared in this scope
digitalWrite(redRightPin, (gearHandleDown != gearDeployRight) && canLight);
^
exit status 1

The error messages were QUITE clear. Your paraphrasing was not. But, clearly, you have not downloaded, or properly installed, some library that you are trying to use.

Thank you for your response.

The directory should have been Bounce2 instead of Bounce.

In any event - can you recommend a tutorial on how to "properly" install a directory?

Montauk_Systems:
In any event - can you recommend a tutorial on how to "properly" install a directory?

Are you trying to use the Teensy Flight Sim Controls system? If so it looks like there are some additional install steps necessary.