static void SetupClient() { Client.Start(SERVER_IP, 1025, 1026, "ArmMaster"); Parse.SetParseHandler(0x80, (Pack) => { MotorControl.SetAllMotorSpeed(0.0f); Slave.Write(new byte[] { 0x80 }); }); for (byte i = 0x9A; i <= 0x9C; i++) { Parse.SetParseHandler(i, (Packet) => { MotorControl.SetMotorSpeed(Packet.Data.ID - 0x9A, UtilData.ToFloat(Packet.Data.Payload)); }); } for (byte i = 0x9D; i <= 0xA0; i++) { Parse.SetParseHandler(i, (Pack) => { Slave.Write(new byte[] { Pack.Data.ID }); Slave.Write(Pack.Data.Payload); }); } }
/// <summary> Writes a string to the UART as a string of bytes. </summary> /// <param name="s"> The string to write. </param> private void WriteString(string s) => UART.Write(Encoding.ASCII.GetBytes(s));