private void btUp_Click(object sender, EventArgs e) { string strsent1 = "1"; if (lbStatus.Text == "Connect") { COM.WriteLine(strsent1); } }
void Start() { com = Camera.main.GetComponent <COM>(); lastDevice = false; actualColor = new Vector4(1, 1, 1, 0); sensitivityText = transform.GetChild(0).GetComponent <TextMeshProUGUI>(); kursor = GameObject.Find("Kursor").GetComponent <PercussionOnBox>(); lastSensitivity = kursor.Divide; }
private void button5_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { COM.LoadVissimNetwork(vissim.GetVissimInstance(), openFileDialog1.FileName); } }
private void ONCOM(object sender, SerialDataReceivedEventArgs e) { // Vector ngat khi nhan du lieu if ((PbConect.Text == "Disconnect")) { data = (string)COM.ReadLine(); } display(data); }
public Weigher(string serialPortName, int baudRate, Parity parity, StopBits stopBits, int dataBits, int dataFromWeigherSelectionCount, bool logEnable, string dateTimeFormat, string logFilePath) { Log.LogEnable = COM.LogEnable = Parser.LogEnable = LogEnable = logEnable; Log.LogFilePath = COM.LogFilePath = Parser.LogFilePath = LogFilePath = logFilePath; Log.DateTimeFormat = COM.DateTimeFormat = Parser.DateTimeFormat = DateTimeFormat = dateTimeFormat; DataFromWeigherSelectionCount = dataFromWeigherSelectionCount >= 5 ? dataFromWeigherSelectionCount : 5; StatusWeigher = (int)COM.Open(serialPortName, baudRate, parity, stopBits, dataBits); }
/// <summary> /// Runs entire simulation step by step /// </summary> /// <param name="signalProgram">Current signal program</param> public void RunStepByStep(SignalProgram signalProgram) { simulationPeriod = COM.getSimulationPeriod(currentSimulation); simulationTime = 0; for (int i = 0; i < (simulationPeriod * simulationResolution); i++) { SimulationStep(signalProgram); simulationTime = simulationTime + (1 / simulationResolution); } //GET SIMULATION RESULTS HERE }
private void button7_Click(object sender, EventArgs e) { try { COM.Write(detal.ToString() + "\n"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button8_Click(object sender, EventArgs e) { try { COM.Write(textBox1.Text + "\n"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void PortClose_Click(object sender, EventArgs e) { if (COM.IsOpen) { COM.Close(); } else { MessageBox.Show("Port Closed."); } }
void Start() { startingPosition = this.transform.parent.position; com = Camera.main.GetComponent <COM>(); draw = GameObject.Find("Tube").GetComponent <DrawVR>(); if (target == null) { target = GameObject.Find("Kursor").transform; } }
void Start() { t = 0.1f; position = new Vector3(0.0f, 0.0f, 0.0f); anglesPosition = new Vector3(0.0f, 0.0f, 0.0f); anglesDelta = new Vector3(0.0f, 0.0f, 0.0f); com1 = COMobj.GetComponent <COM>(); isClicked = false; lastPosition = position; obj = null; isPressed = false; }
private void PortOpen_Click(object sender, EventArgs e) { if (!COM.IsOpen) { COM.Open(); DataReceived += new EventHandle(COMGetData); } else { MessageBox.Show("Port Opened."); } }
private void ONCOM(object sender, SerialDataReceivedEventArgs e) { string[] strArray = { "0" }; strReceive = COM.ReadLine(); if (strReceive != null) { strArray = strReceive.Split(','); data = strArray[0]; // Angle data1 = strArray[1]; // Angle_kalman } }
void Start() { x = transform.GetChild(1).GetComponent <Text>(); y = transform.GetChild(2).GetComponent <Text>(); a1 = transform.GetChild(3).GetComponent <Text>(); a2 = transform.GetChild(4).GetComponent <Text>(); a3 = transform.GetChild(5).GetComponent <Text>(); msg = Camera.main.GetComponent <COM>(); }
private void COM_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { if (COM.IsOpen) { int size = COM.BytesToRead; byte[] receive = new byte[size]; COM.Read(receive, 0, size); string str = Encoding.Default.GetString(receive); ReceiveOnce(str); } }
private void PbSet_Click(object sender, EventArgs e) { string s = "0", speed = "0", angle = "0", speedrotate = "0"; speed = txtSpeed.Text; angle = txtAngle.Text; speedrotate = txtSpeedRotate.Text; s = "S" + "," + speed + "," + angle + "," + speedrotate; if (lbStatus.Text == "Connect") { COM.WriteLine(s); } }
private void btPID3_Click(object sender, EventArgs e) { string pid3 = "0", kp = "0", ki = "0", kd = "0"; kp = txtKp.Text; ki = txtKi.Text; kd = txtKd.Text; pid3 = "PID3" + "," + kp + "," + ki + "," + kd; if (lbStatus.Text == "Connect") { COM.WriteLine(pid3); } }
private void COM_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { if (new_msg != RECV_MSG.New) { recv_msg_length = COM.Read(rbuff, 0, 100); new_msg = RECV_MSG.InProgress; } timer.Interval = 1000; timer.Enabled = true; timer.Start(); new_msg = RECV_MSG.New; // recv_msg_length = 0; timer.Enabled = false; }
private void pictureBox2_MouseDown(object sender, MouseEventArgs e) { float length = (float)Math.Sqrt((main_x - e.X) * (main_x - e.X) + (main_y - e.Y) * (main_y - e.Y)); textBox1.Text = ((int)(length * scale)).ToString(); try { COM.Write(textBox1.Text + "\n"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void Start() { lastPerc = 0; //Setup songs to play percs = new List <AudioClip[]>(); percs.Add(perc1); percs.Add(perc2); percs.Add(perc3); percs.Add(perc4); percs.Add(perc5); percs.Add(perc6); source = GetComponent <AudioSource>(); diffrence = maxLength - minLength; lastPosition = transform.position; waveLength = 0.0f; deltas = new List <Vector3>(); com = Camera.main.GetComponent <COM>(); }
private void PbStart_Click(object sender, EventArgs e) { if (PbStart.Text == "START") { //PbStart.Text = "STOP"; s = "9"; COM.WriteLine(s); } //else //{ // PbStart.Text = "START"; // s = "7"; // COM.WriteLine(s); //} }
//设置COM信息 public static void Init() { com = Common.GetComInfo(); callbtnsetting = GetCallBtnSetting(); orderby = GetOrederBy(); timecolor = GetTimeColor(); TimeOut = 5; UnFinish = 20; users = szwlForm.mainForm.dm.selectUser(); employees = szwlForm.mainForm.dm.selectEmployee(); employeeRFID = szwlForm.mainForm.dm.selectEmployeeRFID(); list_zone = szwlForm.mainForm.dm.selectZone(); list_caller = szwlForm.mainForm.dm.selectCaller(); program = new UserProgram(LogOnForm.currentUser); }
//设置COM信息 public static void Clear() { com = null; callbtnsetting = null; orderby = null; timecolor = null; TimeOut = 5; UnFinish = 20; users = null; employees = null; employeeRFID = null; list_zone = null; list_caller = null; program = null; LogOnForm.currentUser = null; }
void Start() { if (!OnDeltas) { Divide = 8000; } else { Divide = 2500; } Divide = 3000; startPos = new Vector3(0.3f, 0.6f, -3.445f); this.transform.position = startPos; msg = Camera.main.GetComponent <COM>(); lastWriting = msg.IsWritingPen(); }
public void GetData() { dataFromWeigherCount = 0; dataArr = new float[DataFromWeigherSelectionCount - 2]; try { if (COM.mySerialPort.IsOpen == true) { COM.Close(); } COM.mySerialPort.Open(); COM.mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); Log.Write("Scale subscribe for weigh event"); } catch { } }
private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { if (dataFromWeigherCount < DataFromWeigherSelectionCount - 1) { AddDataInArray(sender); dataFromWeigherCount++; } else { float value = Parser.GetFilteredWeight(dataArr); Log.Write($"Weigh done. Finish weigh={value}"); WeighFinish?.Invoke(value); dataArr = null; COM.mySerialPort.DataReceived -= DataReceivedHandler; COM.Close(); } }
void Start() { msg = Camera.main.GetComponent <COM>(); //Reset deltas lastA1 = lastA2 = lastA3 = 0; //Get X XFillLeft = transform.GetChild(0).GetChild(1).GetComponent <Image>(); XFillRight = transform.GetChild(0).GetChild(0).GetComponent <Image>(); XLeft = transform.GetChild(0).GetChild(3).GetComponent <TextMeshProUGUI>(); XRight = transform.GetChild(0).GetChild(2).GetComponent <TextMeshProUGUI>(); //Get Y YFillLeft = transform.GetChild(1).GetChild(1).GetComponent <Image>(); YFillRight = transform.GetChild(1).GetChild(0).GetComponent <Image>(); YLeft = transform.GetChild(1).GetChild(3).GetComponent <TextMeshProUGUI>(); YRight = transform.GetChild(1).GetChild(2).GetComponent <TextMeshProUGUI>(); //Get A1 A1FillLeft = transform.GetChild(2).GetChild(1).GetComponent <Image>(); A1FillRight = transform.GetChild(2).GetChild(0).GetComponent <Image>(); A1Left = transform.GetChild(2).GetChild(3).GetComponent <TextMeshProUGUI>(); A1Right = transform.GetChild(2).GetChild(2).GetComponent <TextMeshProUGUI>(); A1Label = transform.GetChild(2).GetChild(5).GetComponent <TextMeshProUGUI>(); //Get A2 A2 = transform.GetChild(3).gameObject; A2FillLeft = transform.GetChild(3).GetChild(1).GetComponent <Image>(); A2FillRight = transform.GetChild(3).GetChild(0).GetComponent <Image>(); A2Left = transform.GetChild(3).GetChild(3).GetComponent <TextMeshProUGUI>(); A2Right = transform.GetChild(3).GetChild(2).GetComponent <TextMeshProUGUI>(); A2Label = transform.GetChild(3).GetChild(5).GetComponent <TextMeshProUGUI>(); //Get A2 A3 = transform.GetChild(4).gameObject; A3FillLeft = transform.GetChild(4).GetChild(1).GetComponent <Image>(); A3FillRight = transform.GetChild(4).GetChild(0).GetComponent <Image>(); A3Left = transform.GetChild(4).GetChild(3).GetComponent <TextMeshProUGUI>(); A3Right = transform.GetChild(4).GetChild(2).GetComponent <TextMeshProUGUI>(); A3Label = transform.GetChild(4).GetChild(5).GetComponent <TextMeshProUGUI>(); //Scale Tick = transform.GetChild(5).GetChild(1).GetComponent <Image>(); ScaleText = transform.GetChild(5).GetChild(0).GetComponent <TextMeshProUGUI>(); }
void Write_String(byte[] str, int lng) { int crc16 = Calc_CRC(str, lng); byte[] tmp = new byte[str.Length + 2]; Array.Copy(str, 0, tmp, 0, lng); tmp[tmp.Length - 2] = (byte)(crc16 & 0xFF); tmp[tmp.Length - 1] = (byte)((crc16 >> 8) & 0xFF); try { COM.Write(tmp, 0, tmp.Length); } catch (Exception ex) { ex_message = ex.Message; } }
private void button12_Click(object sender, EventArgs e) { double simulationPeriod = COM.getSimulationPeriod(sim.currentSimulation); for (int i = 300; i < simulationPeriod; i = i + 300) { sim.RunContinuos(i); if (i % 600 == 0) { ISignalController SignalController = vissim.GetVissimInstance().Net.SignalControllers.get_ItemByKey(3); SignalController.set_AttValue("ProgNo", 1); } else { vissim.GetVissimInstance().Net.SignalControllers.get_ItemByKey(3).set_AttValue("ProgNo", 2); } } }
void Write_String(string str, int lng) { byte[] tmp_S = Encoding.ASCII.GetBytes(str); int crc16 = Calc_CRC(tmp_S, lng); byte[] tmp = new byte[str.Length + 2]; Array.Copy(tmp_S, 0, tmp, 0, lng); tmp[tmp.Length - 2] = (byte)(crc16 & 0xFF); tmp[tmp.Length - 1] = (byte)((crc16 >> 8) & 0xFF); try { COM.Write(tmp, 0, tmp.Length); } catch (Exception ex) { ex_message = ex.Message; } }
protected virtual void Execute(COM.TIGER.TASK.DAT.Synchronization.Dao.DataHandler dbFrom, Dao.DataHandler dbTarget, string dataFromCmdString) { }