dimanche 16 novembre 2014

How to connect Arduino to FSX

For interfacing Arduino Uno to FSX i use LinK2fs available here http://www.jimspage.co.nz/intro.htm . You don't need any installation , one thing only you have to start FSX before LinK2fs.
I recommend to make some test for understanding the coding . Of course this code is also available on jimspage.
I have made some test with the code MULTI_LCD_simple  , i put my focus only on the altitude and airspeed parameters.



For my test i used a LCD 16x2.
LCD Keypad Shield

I have added the definition for this LCD in the Arduino code:

#include <LiquidCrystal.h> // I call the library 

LiquidCrystal lcd(6, 7, 2, 3, 4, 5); // I define the pins

For the void setup:

 lcd.begin(16, 2);
  lcd.clear();
  
In the void loop  to get the speed and altitude in this way:

case 'P':
    vit = "";
    vit += getChar();
    vit += getChar();
    vit += getChar();

lcd.setCursor(0, 0);
lcd.print("Vitesse " + vit ); 
break; 

case 'D':
    altitude = "";
    altitude += getChar();
    altitude += getChar();
    altitude += getChar();
    altitude += getChar();
    altitude += getChar();

    lcd.setCursor(0, 1);
    delay (11);
    lcd.print("Altitude" + altitude); 
    break; 

After that you download this code in the Arduino.


Here is a little video.

















Aucun commentaire:

Enregistrer un commentaire