我正在使用arduino并以逗号分隔的值连续获取数据。现在我想分隔数据并放入文本框,我的问题如何解析文本框中每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);
}
答案 0 :(得分:0)
要解析Comma Separated Value
,又称CSV
,您可以使用Split
方法。
Dim csvValues As String = "1,2,3,4,5,6,7,8,9"
Dim arrayOfValues() As String = csvValues.Split(","c)
'c after the final quote forces the string to a char datatype