Hello Everyone!
Ive got a really complex question, and Im really hoping someone will be able to give a helping hand.
Im sending Data from VB to the Arduino (Due). This isnt the problem. The information will be sent as a string. For example "DDL3(0,0,0)(0,0,0)(0,0,0)". However each value has a meaning and can differ how the data will be finally presented.
The first three characters have no meaning but still need to be presented as they are. However the 4th character, in this case the "3" will affect the rest of the data. For example if the number was:
2, it would be presented like this (0,0)(0,0)(0,0)
4, it would be presented like this (0,0,0,0)(0,0,0,0)(0,0,0,0)
Below is what I have so far but Im not too sure if its anygood. Im a beginner so dont hate:) haha.
Any help is valued, THANK YOU!
String content = "";
char character;
int Counter, DataCounter;
void loop()
{
if (Serial.available() <= 0) {
}
while(Serial.available()) {
character = Serial.read();
if(character == ','){
Serial.println(content);
Serial.println(Counter);
Serial.println(DataCounter);
content="";
Counter=0;
DataCounter++;
}
else
{
content.concat(character);
Counter++;
}
}
}