Hi I am a newbie to Teensy and Xplane.
The scope of what I am doing is as follows.
I am a student pilot and want to build a Gimbal Cabri G2 cockpit so I can practice my Ground school, Navigation and Radio work at home. I realise there is currently no model yet for the G2 in XPlane, but I am reliably informed it is being made and should be available later this year.
My intention is to build a fully working G2 Cockpit. As I am an experienced builder of electronics and fittings for motorcycles, I am confident I can build all the physical items of a small six pack dash, and all the Heli controls needed to fly the G2.
Input wise I have gone the route of the Leobodnar BU0836x board. I did this because it's plug and play. This allows me to use hall sensors without lots of code. That in turn let me build a custom cyclic and pedals to match the size, weight, and resistance of the real aircraft, without spending £1,000 plus on a pro built set of controls.
While I am purchasing the building a new dedicate PC to fly XPlane from, I have a fast Windows Laptop I am using to test connectivity, inputs and outputs on. As long as I do not attempt to fly the aircraft this Laptop is coping with my panel testing. The system I write on code is a MacBook Pro (I write C# code on my MAC so it seemed like I should stick with it for this exercise).
Input wise everything I have built and tested works great in Xplane. My test inputs are a cyclic, rudder pedals, a twist throttle, a collective, various dash on-off-on switches, rotary encoders, and momentary switches.
Outputwise I want to use Teensy boards as there is great support for integration with XPlane11.
The outputs I am trying to build are the following:
Dash lights - LEDs 12v, however for testing I am using small LEDs suited to an Arduino.
Steeper motors - I have old Aircraft gauges I am gutting and will run with the steeper motors. My intent is to complete a small six pack in real gauges.
3 LCD screens - I will use as the glass touch screens.
While all that is interesting I am starting small with the Teensy LC.
My test platform is a teensy LC, which I have soldered to legs and wires that allow me to attach any pin on the teensy board to a wiring bread board port.
I loaded all the teensy add ons to the Arduino coding editor.
in Code the board is set to TeensyLC, and the USB is set to "Flight Sim Controls"
My first test was the blink program. This works fine. The result is a blinking onboard LED.
My second test was the same blink program with an extra LED added to the bread board. I am using a 62 Ohm resistor which is a correct size for the LEDs I have and the amps from the Teensy. This test works fine, and I get my extra added LED blinking along with the on board LED.
My Thrid test was to follow the example outlined in this thread https://simelectronics.wordpress.com/2012/10/24/gear-panel-tutorial-part-1-three-greens/. This is where I am struggling.
1. The code is straightforward to follow and I have verified in my version of XPlane has the mention XPlane Ref "sim/cockpit/radios/transponder_light". However when I plug in my teensy to my windows laptop running XPlane nothing happens.
So I assumed I had done something wrong regarding the Transponder light. As I wanted to test the landing lights anyway (I have a physical switch working on the landing light in the Cessna Skyhawk model I am using to test inputs and outputs). I changed the code to fit with my actual test goal.
Applying this to the teensy board is fine, but when I attach the board to the XPlane Laptop, nothing happens.
Can anyone help with this problem. I think a number of things are going on.
A: I assume I need to set the teensy board as a Serial device, as I already have a Joy Stick controller assigned to XPlane, the Leobodnar BU0836x board?
B: In Xplane do I need to set anything in the Data Output tab, "GeneralData Output" or "Dataref Read/Write" sections?
In the DataRef ReadWrite section I can see there is a item for the landing lights on state ("sim/cockpit/electrical/landing_lights_on"), and you can send that to either a network connected address or a COM port, as I am connecting to USB I assume if I set a Dataref Read/Write I'll need to change to COM port (3?)
Then in the Teensy code do I need to set up a serial read, or does "FlightSim.update();" handle this by default?
Anyway any help the forum can offer is great appreciated.
Kind regards
Duncan
The scope of what I am doing is as follows.
I am a student pilot and want to build a Gimbal Cabri G2 cockpit so I can practice my Ground school, Navigation and Radio work at home. I realise there is currently no model yet for the G2 in XPlane, but I am reliably informed it is being made and should be available later this year.
My intention is to build a fully working G2 Cockpit. As I am an experienced builder of electronics and fittings for motorcycles, I am confident I can build all the physical items of a small six pack dash, and all the Heli controls needed to fly the G2.
Input wise I have gone the route of the Leobodnar BU0836x board. I did this because it's plug and play. This allows me to use hall sensors without lots of code. That in turn let me build a custom cyclic and pedals to match the size, weight, and resistance of the real aircraft, without spending £1,000 plus on a pro built set of controls.
While I am purchasing the building a new dedicate PC to fly XPlane from, I have a fast Windows Laptop I am using to test connectivity, inputs and outputs on. As long as I do not attempt to fly the aircraft this Laptop is coping with my panel testing. The system I write on code is a MacBook Pro (I write C# code on my MAC so it seemed like I should stick with it for this exercise).
Input wise everything I have built and tested works great in Xplane. My test inputs are a cyclic, rudder pedals, a twist throttle, a collective, various dash on-off-on switches, rotary encoders, and momentary switches.
Outputwise I want to use Teensy boards as there is great support for integration with XPlane11.
The outputs I am trying to build are the following:
Dash lights - LEDs 12v, however for testing I am using small LEDs suited to an Arduino.
Steeper motors - I have old Aircraft gauges I am gutting and will run with the steeper motors. My intent is to complete a small six pack in real gauges.
3 LCD screens - I will use as the glass touch screens.
While all that is interesting I am starting small with the Teensy LC.
My test platform is a teensy LC, which I have soldered to legs and wires that allow me to attach any pin on the teensy board to a wiring bread board port.
I loaded all the teensy add ons to the Arduino coding editor.
in Code the board is set to TeensyLC, and the USB is set to "Flight Sim Controls"
My first test was the blink program. This works fine. The result is a blinking onboard LED.
My second test was the same blink program with an extra LED added to the bread board. I am using a 62 Ohm resistor which is a correct size for the LEDs I have and the amps from the Teensy. This test works fine, and I get my extra added LED blinking along with the on board LED.
My Thrid test was to follow the example outlined in this thread https://simelectronics.wordpress.com/2012/10/24/gear-panel-tutorial-part-1-three-greens/. This is where I am struggling.
1. The code is straightforward to follow and I have verified in my version of XPlane has the mention XPlane Ref "sim/cockpit/radios/transponder_light". However when I plug in my teensy to my windows laptop running XPlane nothing happens.
So I assumed I had done something wrong regarding the Transponder light. As I wanted to test the landing lights anyway (I have a physical switch working on the landing light in the Cessna Skyhawk model I am using to test inputs and outputs). I changed the code to fit with my actual test goal.
Code:
// Our LED pin number
const int blueLedPin = 9;
// Special variable to access the landing light
FlightSimInteger landingLight;
// setup runs once
void setup() {
// set pin mode to out put
pinMode(blueLedPin, OUTPUT);
landingLight = XPlaneRef("sim/cockpit/electrical/landing_lights_on");
landingLight.onChange(updateLED);
pinMode(LED_BUILTIN, OUTPUT); // pin 11 on Teensy 2.0, pin 6 on Teensy++ 2.0
}
// loop runs repetitively, as long as power is on
void loop() {
FlightSim.update(); // causes X-Plane's changes to be received
}
// updateLED runs only when X-Plane changes the Landing Light state
void updateLED(long value) {
if (value == 0) { // Landing light is off
//Turn LED off
digitalWrite(blueLedPin, LOW);
digitalWrite(LED_BUILTIN, LOW);
} else { // Landing light must be on
// Turn LED on
digitalWrite(blueLedPin, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
}
}
Applying this to the teensy board is fine, but when I attach the board to the XPlane Laptop, nothing happens.
Can anyone help with this problem. I think a number of things are going on.
A: I assume I need to set the teensy board as a Serial device, as I already have a Joy Stick controller assigned to XPlane, the Leobodnar BU0836x board?
B: In Xplane do I need to set anything in the Data Output tab, "GeneralData Output" or "Dataref Read/Write" sections?
In the DataRef ReadWrite section I can see there is a item for the landing lights on state ("sim/cockpit/electrical/landing_lights_on"), and you can send that to either a network connected address or a COM port, as I am connecting to USB I assume if I set a Dataref Read/Write I'll need to change to COM port (3?)
Then in the Teensy code do I need to set up a serial read, or does "FlightSim.update();" handle this by default?
Anyway any help the forum can offer is great appreciated.
Kind regards
Duncan