https://www.youtube.com/watch?v=pdeHEoy ... 0c5xocnw0k
So here is the Arduino code I used for the slip/skid indicators. There is no real need for the variable speed servo library anymore so it can be removed. Enjoy!
/*
This code is in the public domain
For use with "Link2fs_Multi"
Jimspage.co.nz
My thanks to the Guys that gave me snippets of code.
// Code adapted for flight simulator interface of turn coordinator ball
*/
#include <VarSpeedServo.h> //Different Servo Library which offers variable speed
VarSpeedServo myServo; //define myservo (NOTE- it has different case letters than normal servo library)
int CodeIn;// used on all serial reads
int KpinNo;
int Koutpin;
String tc;
int tc1;
int val;
String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;
void setup()
{
myServo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(115200);
}
void loop() {
if (Serial.available()) {
CodeIn = getChar();
if (CodeIn == '=') {EQUALS();} // The first identifier is "="
if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
}
}
char getChar()// Get a character from the serial buffer
{
while(Serial.available() == 0);// wait for data
return((char)Serial.read());// Thanks Doug
}
void EQUALS(){ // The first identifier was "="
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;
case 'B':
//Do something
break;
case 'C':
//Do something
break;
//etc etc etc
}
}
void LESSTHAN(){ // The first identifier was "<"
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'N'://Found the second identifier Turn coordinator
{
tc = "";
tc += getChar();
tc += getChar();
tc += getChar();
//tc += getChar();
// tc += getChar();
//tc += getChar();
int tc1 = tc.toInt(); // convert it to an integer (Thanks Phill)
val = tc1; // reads the value of the data from FSX turn coordinator
val = map(val, 0, 256, 0, 179); // scale it to use it with the servo ( between 0-256 for FSX turn coordinator,between 0 and 180 for servo)
myServo.slowmove(val,45); // sets the servo position according to the scaled value (second number is servo speed 0=slowest, 255=fastest)
Serial.println (val); //added for troubleshooting
}
break;
case 'B':
//Do something
break;
case 'C':
//Do something
break;
//etc etc etc
}
}
void QUESTION(){ // The first identifier was "?"
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;
case 'B':
//Do something
break;
case 'C':
//Do something
break;
//etc etc etc
}
}
void SLASH(){ // The first identifier was "/" (Annunciator)
//Do something
}