void SerialProc() { String datain;// = serial.GetDataIncome(); while (true) { if (serial.IsDataIn()) { datain = serial.GetDataIncome(); if (datain == SERIAL_UP) { if (systemState == PLAY) { if (speed == SPEED_MIN) { } else { speed--; timer1.Interval = speed * 100; } } MessageBox.Show("up speed" + speed); //while (serial.GetDataIncome() == SERIAL_UP) ; } else if (datain == SERIAL_DOWN) { if (systemState == PLAY) { if (speed == SPEED_MAX) { } else { speed++; timer1.Interval = speed * 100; } } MessageBox.Show("up down" + speed); //while (serial.GetDataIncome() == SERIAL_DOWN) ; } else if (datain == SERIAL_OK) { } else if (datain == SERIAL_RESET) { } else if (datain == SERIAL_PAUSE) { } serial.ResetFlag(); } } }
void SerialProc() { String datain;// = serial.GetDataIncome(); while (true) { if (serial.IsDataIn()) { datain = serial.GetDataIncome(); if (datain == SERIAL_UP) { if (systemState == PLAY) { if (speed == SPEED_MIN) { } else { lock (syncObj1) { speed--; timer1.Interval = speed * 100; } } } //MessageBox.Show("up speed" + speed); //while (serial.GetDataIncome() == SERIAL_UP) ; } else if (datain == SERIAL_DOWN) { if (systemState == PLAY) { if (speed == SPEED_MAX) { } else { speed++; timer1.Interval = speed * 100; } } //MessageBox.Show("up down" + speed); //while (serial.GetDataIncome() == SERIAL_DOWN) ; } else if (datain == SERIAL_OK) { //ok_Event(); if (bollState == BOLL_READY) { timer2.Enabled = true; bollState = BOLL_RUNNING; //MessageBox.Show("nem xong"); } } else if (datain == SERIAL_RESET) { } else if (datain == SERIAL_PAUSE) { } serial.ResetFlag(); } Thread.Sleep(500); } }