I am creating a string
through two values, one of them read through a slider and another of a check box. Together the two in a string called a
and sending at the same time in the serial.
Follow the code:
private async void SendSerial()
{
DirectionRotation = (bool)RotateInverter.IsChecked ? 1 : 0;// if ternario, check box marcado envia 1, check box desmarcado envia 0
string a = _dataSent1 = $"{Pwm_Control.Value.ToString()},{DirectionRotation}";//cria string de envia para a serial
if (sp.IsOpen)
{
sp.Write(a);//escreve na serial
}
else
{
await this.ShowMessageAsync("AVISO", "Porta desconectada");
}
this.Dispatcher.Invoke(() => { StatusSerialSent.Text = $"StatusSerialSent : {a}"; });// mostra na tela valor que esta sendo enviado
}
I would like to know how I could send two strings, one in sequence. But with a however, for example the string with the value of check box
is only sent when the value of it is changed. Does anyone have a clue how to do it?