我使用arduino並以逗號分隔的值串行獲取數據。現在我想隔離數據並付諸文本框中,我的問題如何解析在文本框中顯示VB的數據數據,每1秒在vb中解析逗號分隔的值
int Count1;
int Count2;
int Count3;
int Count4;
int Count5;
float Sensor_Out1;
float Sensor_Out2;
float Sensor_Out3;
float Sensor_Out4;
float Sensor_Out5;
void TakeReading()
{
Count1 = analogRead(A1);
Count2=analogRead(A2);
Count3=analogRead(A3);
Count4=analogRead(A4);
Count5=analogRead(A5);
Sensor_Out1= 0.0336666666667*Count1 - 17.10;
Sensor_Out2= 0.0336666666667*Count2 - 17.10;
Sensor_Out3= 0.0336666666667*Count3 - 17.10;
Sensor_Out4 = 0.0336666666667*Count4 - 17.10;
Sensor_Out5= 0.0336666666667*Count5 - 17.10;
}
void setup()
{
Serial.begin(9600);
}
void loop()
{
TakeReading();
Serial.print(Sensor_Out1);
Serial.print(",");
Serial.print(Sensor_Out2);
Serial.print(",");
Serial.print(Sensor_Out3);
Serial.print(",");
Serial.print(Sensor_Out4);
Serial.print(",");
Serial.println(Sensor_Out5);
delay(1000);
}
這不是VB.Net,也不是VBA - 請更正標籤。 – OneFineDay 2014-10-10 04:24:34
@OneFineDay我從串口獲取arduino的數據。我的問題是如何解析和顯示在Visual Basic 2010上。因此保留標記vba – 2014-10-10 04:40:37
您提供的代碼的目的是什麼? – OneFineDay 2014-10-10 04:45:17