Hi all - I am new to this forum and very new to the the Teensy. I appreciate any advice anyone might have as to how to solve this problem and thank you for your patience.
I am building a static Boeing 727 simulator using all OEM parts. One element of the instrumentation requires that I transduce a synchro/control transformer (which is AC based), which is basically a way to determine where a heading bug is set on the face of a 360 degree instrument face. In order to do that, I have a synchro to digital converter which takes the signal from the synchro and converts it to a 14 bit 'word' where each pin of the converter is 'on' when it is supplied with 5vdc. I need the Teensy to read all 14 pins of the synchro converter and using some math come up with the angle in degrees that the heading bug is set to.
I have done all of the other elements of this project using Teensy 4.1's, but am aware that the 4.1 is limited to 3.3vdc. So, I bought up a bunch of Teen$y 3.5's in order to accommodate the 5vdc.
Those arrived today and I was eager to try it out. Unfortunately the code (which I suspect is very very simple relative to what others are capable of in this group) would not compile and I keep getting 'Compilation error. Exit status 1'. I have tried muting each line of the code and then adding them back one at a time and the problem starts as soon as I send it any code. The code will compile and go to a Teensy 4.1 without a problem. I am using the most current Arduino IDE and I have tried loading Arduino IDE v 1.8.16 without any luck. Note also that I have the Flight Sim Controls plug in running and the appropriate line checked in the tools/USB tab.
Here is the code:
/* define the pins for the 14 separate input channels*/
int dpin1 = 23;
int dpin2 = 22;
int dpin3 = 21;
int dpin4 = 20;
int dpin5 = 19;
int dpin6 = 18;
int dpin7 = 17;
int dpin8 = 16;
int dpin9 = 15;
int dpin10 = 14;
int dpin11 = 41;
int dpin12 = 40;
int dpin13 = 39;
int dpin14 = 38;
/* Hdgbug will link to XPlane to send the calculated angle to the simulation software. Hdgct will do the work of calculating the angle*/
FlightSimFloat Hdgbug;
FlightSimFloat Hdgct;
void setup (){
Serial.begin(9600);
pinMode(dpin1, INPUT);
pinMode(dpin2, INPUT);
pinMode(dpin3, INPUT);
pinMode(dpin4, INPUT);
pinMode(dpin5, INPUT);
pinMode(dpin6, INPUT);
pinMode(dpin7, INPUT);
pinMode(dpin8, INPUT);
pinMode(dpin9, INPUT);
pinMode(dpin10, INPUT);
pinMode(dpin11, INPUT);
pinMode(dpin12, INPUT);
pinMode(dpin13, INPUT);
pinMode(dpin14, INPUT);
/* Set the Hdgbug variable to the XPlane dataref*/
Hdgbug = XPlaneRef("sim/cockpit/autopilot/heading");
}
void loop() {
FlightSim.update();
/* read the 14ch output of the synchro converter*/
int pin1 = digitalRead(dpin1);
int pin2 = digitalRead(dpin2);
int pin3 = digitalRead(dpin3);
int pin4 = digitalRead(dpin4);
int pin5 = digitalRead(dpin5);
int pin6 = digitalRead(dpin6);
int pin7 = digitalRead(dpin7);
int pin8 = digitalRead(dpin8);
int pin9 = digitalgRead(dpin9);
int pin10 = digitalRead(dpin10);
int pin11 = digitalRead(dpin11);
int pin12 = digitalRead(dpin12);
int pin13 = digitalRead(dpin13);
int pin14 = digitalRead(dpin14);
/* reset the work variable to 0 with each cycle of the loop*/
Hdgct=0;
/*Heres where the calculations are made based on the output of the external converter. As an aside, I tried using the += operator and it didn’t like that..*/
if (pin1 == HIGH) {Hdgct = 180;}
if (pin2 == HIGH) {Hdgct = Hdgct + 90;}
if (pin3 == HIGH) {Hdgct = Hdgct + 45;}
if (pin4 == HIGH) {Hdgct = Hdgct + 22.5;}
if (pin5 ==HIGH) {Hdgct = Hdgct + 11.25;}
if (pin6 ==HIGH) {Hdgct = Hdgct + 5.625;}
if (pin7 ==HIGH) {Hdgct = Hdgct + 2.8125;}
if (pin8 ==HIGH) {Hdgct = Hdgct + 1.40625;}
if (pin9 ==HIGH) {Hdgct = Hdgct + 0.70313;}
if (pin10 ==HIGH) {Hdgct = Hdgct + 0.35156;}
if (pin11 ==HIGH) {Hdgct = Hdgct + 0.17578;}
if (pin12 ==HIGH) {Hdgct = Hdgct + 0.08790;}
if (pin13 ==HIGH) {Hdgct = Hdgct + 0.04395;}
if (pin14 ==HIGH) {Hdgct = Hdgct + 0.02197;}
/*Now the calculated angle gets sent to XPlane through the Hdgbug variable*/
Hdgbug=Hdgct;
}
Thank you SO much in advance for any guidance.
Jon
I am building a static Boeing 727 simulator using all OEM parts. One element of the instrumentation requires that I transduce a synchro/control transformer (which is AC based), which is basically a way to determine where a heading bug is set on the face of a 360 degree instrument face. In order to do that, I have a synchro to digital converter which takes the signal from the synchro and converts it to a 14 bit 'word' where each pin of the converter is 'on' when it is supplied with 5vdc. I need the Teensy to read all 14 pins of the synchro converter and using some math come up with the angle in degrees that the heading bug is set to.
I have done all of the other elements of this project using Teensy 4.1's, but am aware that the 4.1 is limited to 3.3vdc. So, I bought up a bunch of Teen$y 3.5's in order to accommodate the 5vdc.
Those arrived today and I was eager to try it out. Unfortunately the code (which I suspect is very very simple relative to what others are capable of in this group) would not compile and I keep getting 'Compilation error. Exit status 1'. I have tried muting each line of the code and then adding them back one at a time and the problem starts as soon as I send it any code. The code will compile and go to a Teensy 4.1 without a problem. I am using the most current Arduino IDE and I have tried loading Arduino IDE v 1.8.16 without any luck. Note also that I have the Flight Sim Controls plug in running and the appropriate line checked in the tools/USB tab.
Here is the code:
/* define the pins for the 14 separate input channels*/
int dpin1 = 23;
int dpin2 = 22;
int dpin3 = 21;
int dpin4 = 20;
int dpin5 = 19;
int dpin6 = 18;
int dpin7 = 17;
int dpin8 = 16;
int dpin9 = 15;
int dpin10 = 14;
int dpin11 = 41;
int dpin12 = 40;
int dpin13 = 39;
int dpin14 = 38;
/* Hdgbug will link to XPlane to send the calculated angle to the simulation software. Hdgct will do the work of calculating the angle*/
FlightSimFloat Hdgbug;
FlightSimFloat Hdgct;
void setup (){
Serial.begin(9600);
pinMode(dpin1, INPUT);
pinMode(dpin2, INPUT);
pinMode(dpin3, INPUT);
pinMode(dpin4, INPUT);
pinMode(dpin5, INPUT);
pinMode(dpin6, INPUT);
pinMode(dpin7, INPUT);
pinMode(dpin8, INPUT);
pinMode(dpin9, INPUT);
pinMode(dpin10, INPUT);
pinMode(dpin11, INPUT);
pinMode(dpin12, INPUT);
pinMode(dpin13, INPUT);
pinMode(dpin14, INPUT);
/* Set the Hdgbug variable to the XPlane dataref*/
Hdgbug = XPlaneRef("sim/cockpit/autopilot/heading");
}
void loop() {
FlightSim.update();
/* read the 14ch output of the synchro converter*/
int pin1 = digitalRead(dpin1);
int pin2 = digitalRead(dpin2);
int pin3 = digitalRead(dpin3);
int pin4 = digitalRead(dpin4);
int pin5 = digitalRead(dpin5);
int pin6 = digitalRead(dpin6);
int pin7 = digitalRead(dpin7);
int pin8 = digitalRead(dpin8);
int pin9 = digitalgRead(dpin9);
int pin10 = digitalRead(dpin10);
int pin11 = digitalRead(dpin11);
int pin12 = digitalRead(dpin12);
int pin13 = digitalRead(dpin13);
int pin14 = digitalRead(dpin14);
/* reset the work variable to 0 with each cycle of the loop*/
Hdgct=0;
/*Heres where the calculations are made based on the output of the external converter. As an aside, I tried using the += operator and it didn’t like that..*/
if (pin1 == HIGH) {Hdgct = 180;}
if (pin2 == HIGH) {Hdgct = Hdgct + 90;}
if (pin3 == HIGH) {Hdgct = Hdgct + 45;}
if (pin4 == HIGH) {Hdgct = Hdgct + 22.5;}
if (pin5 ==HIGH) {Hdgct = Hdgct + 11.25;}
if (pin6 ==HIGH) {Hdgct = Hdgct + 5.625;}
if (pin7 ==HIGH) {Hdgct = Hdgct + 2.8125;}
if (pin8 ==HIGH) {Hdgct = Hdgct + 1.40625;}
if (pin9 ==HIGH) {Hdgct = Hdgct + 0.70313;}
if (pin10 ==HIGH) {Hdgct = Hdgct + 0.35156;}
if (pin11 ==HIGH) {Hdgct = Hdgct + 0.17578;}
if (pin12 ==HIGH) {Hdgct = Hdgct + 0.08790;}
if (pin13 ==HIGH) {Hdgct = Hdgct + 0.04395;}
if (pin14 ==HIGH) {Hdgct = Hdgct + 0.02197;}
/*Now the calculated angle gets sent to XPlane through the Hdgbug variable*/
Hdgbug=Hdgct;
}
Thank you SO much in advance for any guidance.
Jon