Csharp TX to Arduino RX using same packet structure as HK WiFi RX






This is the comm protocol compatible with Hobbyking IOS & Android 4CH WiFi Receiver




private void sendRawChannels(int ch1, int ch2, int ch3, int ch4)
{
byte[] buffer = new byte[11];

//Header
buffer[0] = 85;
buffer[1] = 0;
buffer[2] = 11;
buffer[3] = 0;

//Channels
buffer[4] = (byte)(ch1 & 255);
buffer[5] = (byte)(ch2 & 255);
buffer[6] = (byte)(ch3 & 255);
buffer[7] = (byte)(ch4 & 255);

buffer[8] = 0;
buffer[9] = 0;

int sum = 0;
for (int i = 0; i < 9; i++)
sum += (int)buffer[i];

buffer[10] = (byte)(sum % 256);

sock.Client.Send(buffer);

}

The boat for this is here

Arduino

C Sharp


Related Posts by Categories

0 comments:

Post a Comment




Blog Archive

Powered by Blogger.