Hey guys,
I have a few text boxes in VB6, and I'd like to send them all to the Arduino and assign them into an array.
I'm having a pretty hard time understanding exactly how to process serial data from the Arduino, so am asking for a bit of help.
If, for example, I had the numbers: 48, 60, 62, 63, 65, 67, 69, 70, 72, 74 in VB6, and I wanted to send them to the Arduino, and put them into a multidimensional array, how could I send all these numbers at once (Probably with an identifier, so the Arduino knows where they need to go in the array).
I have this code here
char c, t;
int nnn;
if(Serial.available() > 0) // If there is data to read
{
c = Serial.read(); // Get a character
delay(50);
if(c >= 'a' && c <= 'z') // If it's a command
{
nnn = 0;
while(Serial.available() > 0) // While there is still data
{
t = Serial.read(); // Read next character
if(t == ',' || t == ' ')
continue; // Skip commas and spaces
if(t >= '0' && t <= '9') // If it's a number
{
nnn *= 10; // Multiply previous value by 10
nnn += t - '0'; // Add the new digit
}
else
break;
delay(50);
}
}
}
// Now, do something with c and nnn
switch(c)
{
case 'a':
EEPROM.write(1,nnn);
break;
case 'b':
EEPROM.write(2,nnn);
break;
}
However, for my application, I'd require almost 42 different letters for my application!
So basically, a string of numbers and an identifier sent over serial, processed by an Arduino and dumped into an array? Is it possible to send all the numbers at once?
For example, if I send: a, 48, 60, 62, 63, 65, 67, 69, 70, 72, 74
Over serial, the Arduino would know to put it in the first "dimension" of the array, and the numbers are the 10 data values for that dimension.
Cheers,
Dan