Arduino板應用:Microsoft Flight Simulator的儀表板

Submitted by saladlam on

05102011-0001.jpg

05102011-0002.jpg

預備物品:
硬件:Arduino Duemilanove/Uno,CLCD-BOOSTER
軟件:MS Flight Simulator 2004,FSUIPC 3.99,MS Visual C++ 2010 Express Edition

功能:
1.Arduino的display會打出NAV1 active frequency(左),同埋NAV1 standby frequency(右)。
2.三個按鈕的功用,分別為調高(D8),調底standby frequency(D6),同埋交換active和standby frequency(D7)。當按下了制之後,FS畫面和Arduino的display會作出相應的更新。

程式結構:
FSUIPC是Microsoft Flight Simulator的插件。可以讀取和更改FS內的數據,所有其他的插件同埋FS專用硬件,都需要它。FSUIPC dll同埋SDK在這裏下載。在SDK裏已經有Example程式,和FSUIPC溝通的方法應該好易掌握。它還有一個叫"FS-Interrogate 2"的程式,裏面已經記錄了所有可以用的參數,方便程式開發。
電腦端的程式的任務,是透過FSUIPC讀取FS相關數據,透過serial port傳送到Arduino。而Arduino firmware會讀取serial port數據,然後把它傳到display。Arduino firmware也會讀取按鈕信息,然後傳回到電腦,令到FS作出相應的更新。
由於時間關係,程式只是"可以動",沒有時間寫例外處理同埋把程式最佳化。若果要改進程式,可以把FSUIPC端同埋serial端用thread處理,再加上Mutex防止Deadlock,最後要在serial port做error checking。唔知要多花幾多倍的時間才完成。

後記:
我寫這個程式的目的只是測試腦裏的是否行得通。本來以為兩天可以完成,最後是用了四天時間。因為不熟悉使用Windows API庫寫程式,所以花了很多時間找參考,反而Arduino firmware部分覺得簡單。

程式碼:
在此下載
除了第三方程式庫外,以GPL第二版或之後版本發佈。

其它類似應用:
http://www.jimspage.co.nz/intro.htm
http://www.mycockpit.org/forums/forumdisplay.php/323-Arduino-Cards-amp-Link2FS

Add new comment

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
Enter the characters shown in the image.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.