gobetwino simple program

hi there,

i am trying to program a simple code to go from my arduino to excel to produce a graph.

at the moment i am just trying to send number using this arduino code

int value1 = 1;
int value2 = 1;
int value3 = 1;

void setup() 
{ 
  Serial.begin(9600); 
  Serial.println("#S|SPXL|[]#");        // start EXCEL
} 

void loop() 
{   sendValues();
value1 ++;
value2 ++;
value3 ++;
} 

void sendValues() 
{
    //Send the values as though it was typed into Excell, using the SENDK command
    // This is the total line that is send: #S,SENDK,[pId; potValue1 {TAB} potValue2 {DOWN} {LEFT} ]#
     Serial.print("#S|SENDK|[");
     Serial.print(value1);
     Serial.print(" {TAB} ");
     Serial.print(value2);
      Serial.print(" {TAB} ");
     Serial.print(value3);
     Serial.print(" {DOWN} ");
     Serial.print(" {LEFT} ");
     Serial.println("]#");
     // wait up to 1000 ms for answer from Gobetwino, answer will be in serInString, answer is 0 if all is OK
     //Deal with answer here - omitted in this example
     delay(2000);
  }

when i open gobetwino, the correct excel file is opend but no numbers are entered, the gobetwino window displays this:

16/04/2013 11:17:23 Serial port : COM3 opened at 9600 baud
16/04/2013 11:17:24 Commandstring recieved : #S|SPXL|[]#
16/04/2013 11:17:24 Command parsed OK
16/04/2013 11:17:24 Executing command : SPXL
16/04/2013 11:17:33 Process : C:\Users\Dani\Documents\Arduino\gobetwino\samples\trial.xls started. Proces ID = 0
16/04/2013 11:17:33 Commandstring recieved : #S|SENDK|[1 {TAB} 1 {TAB} 1 {DOWN} {LEFT} ]#
16/04/2013 11:17:33 The parameters in the command : #S|SENDK|[1 {TAB} 1 {TAB} 1 {DOWN} {LEFT} ]# are not correct for the command type
16/04/2013 11:17:33 Commandstring recieved : #S|SENDK|[2 {TAB} 2 {TAB} 2 {DOWN} {LEFT} ]#
16/04/2013 11:17:33 The parameters in the command : #S|SENDK|[2 {TAB} 2 {TAB} 2 {DOWN} {LEFT} ]# are not correct for the command type
16/04/2013 11:17:33 Commandstring recieved : #S|SENDK|[3 {TAB} 3 {TAB} 3 {DOWN} {LEFT} ]#
16/04/2013 11:17:33 The parameters in the command : #S|SENDK|[3 {TAB} 3 {TAB} 3 {DOWN} {LEFT} ]# are not correct for the command type

etc.

can anyone help as to why this does not display on the excel speadsheet please?

thanks in advance

Richard (new to software)

can anyone help as to why this does not display on the excel speadsheet please?

Doesn't

The parameters in the command : #S|SENDK|[1 {TAB} 1 {TAB} 1 {DOWN} {LEFT} ]# are not correct for the command type

tell you anything?

Sending data to an application via key strokes is a horrible way to do it, and I think with something as complex as Excel that's a recipe for disaster.

If you want to generate the 'spreadsheet' and then display it (not updating subsequently) then I'd just append all your data to a CSV file and then open the CSV file in Excel.

If you want the spreadsheet to display new data as it is received then there is a plug-in for Excel which enables it to receive data from a serial port and append to the current spreadsheet. This can be used to generate live charts, tables etc.

Check the sample code that comes with GoBetwino, there is an example that does just what you want to do.

You are mising the process id that you should have stored when you called the first command to start Excel.

This should be send in the SENDK commands

It was the sample code that I changed as I didn't need to send via email as it was suggesting, I purely just need to do a graph of how many times a person has entered a room, was thinking that I could do this using excel, so it arduino would update a value next to someone's name everything they enter. Just a very simple program is what I need.

What do you mean process id? I thought I was using sendk?

Thank you for your swift reply

Check the GoBetwino user manual page 17

thank you once again for your quick response.
i see where you are now indicating (PID) and will implement it tomorrow and let you know how i get on.
richard

Mikmo,

in your example you are using char then converting to int, the results i want to send are in integers to begin with,

what would my process ID be for this as yours is:

readSerialString(serInString, 5000); // wait 5 seconds (max) for answer from Gobetwino (=porcess ID)
pId= atoi(serInString); // convert result to integer

i dont understand what this means:

Serial.println("#S|SENDK|[PID&keystrokes to send]#"); Where PID is the process ID of the
program that the keystrokes is send to,

(found in manual page 17)

thanks in advance

richard

the results i want to send are in integers to begin with,

How does that relate to what GoBetwino sends YOU?

i dont understand what this means:

Serial.println("#S|SENDK|[PID&keystrokes to send]#"); Where PID is the process ID of the

It means that you have to substitute the process ID in place of PID.

When you send the first command to GoBetwino to start Excel, GoBetwino returns the PID to you. You must read and store that number.

This is the number you should send with each subsequent call to your SENDK command.