Skip to content

Instantly share code, notes, and snippets.

@MKo-xx
Created April 6, 2011 15:00
Show Gist options
  • Save MKo-xx/905793 to your computer and use it in GitHub Desktop.
Save MKo-xx/905793 to your computer and use it in GitHub Desktop.
...
private UdpClient sending_UdpClient = new UdpClient();
private void timer1_Tick(object sender, EventArgs e)
{
float throttle = throttle_trackBar.Value;
throttle /= 10;
throotle_textBox.Text = throttle.ToString();
float elevator = elevator_trackBar.Value - 10;
elevator /= 10;
elevator_textBox.Text = elevator.ToString();
float aileron = aileron_trackBar.Value - 10;
aileron /= 10;
aileron_textBox.Text = aileron.ToString();
// add "," separators and new line at the end
// as desribed in inputprotocol.xml
String str = aileron.ToString() + "," + elevator.ToString()
+ "," + throttle.ToString() + "\n";
Byte[] sendBytes = Encoding.ASCII.GetBytes(str);
sending_UdpClient.Send(sendBytes, sendBytes.Length, "127.0.0.1", 49000);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment