コード例 #1
0
ファイル: Form1.cs プロジェクト: ytian328/GY521Panel
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     getAvailablePorts();
     this.messageReceived.Clear();
     this.messageSent.Clear();
     this.pitchRoll.Image = PitchRoll.DrawPitchRoll(0, 0, this.pitchRoll.Size);
     this.compass.Image   = Compass.DrawCompass(0, 0, this.maxPitch, 0, this.maxRoll, this.compass.Size);
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ytian328/GY521Panel
        public Form1()
        {
            InitializeComponent();
            getAvailablePorts();
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();

            watcher.PositionChanged += watcher_PositionChanged;
            watcher.Start();

            this.compass.BackColor = System.Drawing.Color.Black;
            this.compass.Image     = Compass.DrawCompass(0, 0, this.maxPitch, 0, this.maxRoll, this.compass.Size);

            this.pitchRoll.BackColor = System.Drawing.Color.Black;
            this.pitchRoll.Image     = PitchRoll.DrawPitchRoll(0, 0, this.pitchRoll.Size);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: ytian328/GY521Panel
 private void read()
 {
     while (this.serialPort1.IsOpen)
     {
         try
         {
             if (this.serialPort1.BytesToRead > 0)
             {
                 this.message = serialPort1.ReadLine();
                 this.setText(message);
                 if (message.Length > 0 && message.IndexOf("ypr") == 0)
                 {
                     string[] splitMessage = message.Split('\t');
                     double   yaw          = Double.Parse(splitMessage[1]);
                     double   pitch        = Double.Parse(splitMessage[2]);
                     double   roll         = Double.Parse(splitMessage[3]);
                     this.compass.Image   = Compass.DrawCompass(yaw, pitch, this.maxPitch, roll, this.maxRoll, this.compass.Size);
                     this.pitchRoll.Image = PitchRoll.DrawPitchRoll(pitch, roll, this.pitchRoll.Size);
                 }
             }
         }
         catch (TimeoutException) { }
     }
 }