private void sendMotorData(int motormode) { Thumperdata data = new Thumperdata(); data.LEDred = RedTrackbar.Value; data.LEDgreen = GreenTrackbar.Value; data.LEDblue = BlueTrackbar.Value; data.MotorMode = motormode; data.MotorSpeed = MotorspeedTrackbar.Value; data.MotorYaw = MotoryawTrackbar.Value; string json = JsonConvert.SerializeObject(data); SendData(json); Console.WriteLine(json); }
private void BlueTrackbar_Scroll(object sender, EventArgs e) { Thumperdata data = new Thumperdata(); data.LEDred = RedTrackbar.Value; data.LEDgreen = GreenTrackbar.Value; data.LEDblue = BlueTrackbar.Value; data.MotorMode = 0; data.MotorSpeed = 0; data.MotorYaw = MotoryawTrackbar.Value; string json = JsonConvert.SerializeObject(data); //String to_send = "" + RedTrackbar.Value + ":" + GreenTrackbar.Value + ":" + BlueTrackbar.Value; SendData(json); Console.WriteLine(json); }
private void StopButton_Click(object sender, EventArgs e) { Thumperdata data = new Thumperdata(); data.LEDred = RedTrackbar.Value; data.LEDgreen = GreenTrackbar.Value; data.LEDblue = BlueTrackbar.Value; if (EmergystopCheckbox.Checked) { data.MotorMode = 5; } else { data.MotorMode = 0; } data.MotorSpeed = 0; data.MotorYaw = 0; string json = JsonConvert.SerializeObject(data); SendData(json); Console.WriteLine(json); }