public async Task <object> Connect(string input) { return(await Task.Run(() => { ArduinoInfo = JsonConvert.DeserializeObject <SettingsModel>(File.ReadAllText(input)).ArduinoInfo; Receiver.DisConnect(); Receiver.PortName = ArduinoInfo.PortName; Receiver.BaudRate = ArduinoInfo.BaudRate; Receiver.Parity = ArduinoInfo.Parity; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; return Receiver.Connect(); })); }
static void Main(string[] args) { Receiver.DisConnect(); Receiver.PortName = "COM3"; Receiver.BaudRate = 9600; Receiver.Parity = Parity.None; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; Receiver.Connect(); FPSAndCPUTemperature Reader = new FPSAndCPUTemperature(); Reader.Start(); Console.ReadLine(); }
public async Task <object> Connect(string input) { return(await Task.Run(() => { GifbuModel = JsonConvert.DeserializeObject <GifbuAppModel>(File.ReadAllText(input)); WebSocketClient.URI = "ws://localhost:13100"; WebSocketClient.Connect(); Receiver.DisConnect(); Receiver.PortName = "COM" + GifbuModel.Machine.PortName; Receiver.BaudRate = GifbuModel.Machine.BaudRate; Receiver.Parity = GifbuModel.Machine.Parity; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; return Receiver.Connect(); })); }