concatenate ints with cons chars

Hi

I am trying to print the following all on one line

 Serial.println(',,' += Mapped_Aux1 += '/' += Mapped_Aux3 += '/' += Mapped_Gear += '/' += Mapped_Flaps += '/' += WF_C += '/' += WF_WL += '/' += WF_FUF += '/' += LG_UD += '/' += LG_Doors += '/' += LG_BOF += '/' += CF_Pos += '/' += CF_AM += '/' += E_Temp += '/' += E_Choke += '/' += E_Imomb += '/' += E_Starter += '/' += C_OC += ',');

Mapped_Aux1, etc are all integers.

However I get the following error when compiling,
Serial_Coms:159: error: lvalue required as left operand of assignment

if I use "/" instead of '/' I get the following,
Serial_Coms:159: error: invalid conversion from 'const char*' to 'int'
Serial_Coms:159: error: assignment of read-only location '",,"'

I know that I can do this using

 Serial.print(",,");
    Serial.print(Mapped_Aux1);
    Serial.print("/");

etc, with a Serial.println at the end.
However this can cause problems with the VB program I am creating that the arduino is communicating with if the arduino starts printing half way down the line when the port is first opened.

Any help or ideas would be appreciated.
Thanx

Some research on the sprintf() and/or snprintf() functions would pay dividends for you.

I am trying to print the following all on one line

"Printing all on one line" and "printing using one statement" are not the same thing. The first is trivial. The second wastes resources and makes NO difference to the receiver.

Hi Paul
If the first is trivial (Not worth doing, or blatantly obvious) Yes it is but it does not work and the second waists resources what do you suggest to do?

Printing using one statement is, or at least that is what I think needs to happen. Like I said if I print over multiple lines of code still actually printing on the same line the first print is where I come unstuck.
eg instead of printing ,a,b,c/d/e/f/g/h,i (example only not what I am trying to print) I may get /e/f/g/h,i or sometimes the first line will be the whole thing or others even less h,i
This only happens on the first line when the serial port is opened after that is is not a problem.
Thus creates a problem when parsing data in the VB program.

UKHeliBob
Thanks for the pointer about sprintf() and/or snprintf() I think that that would work however I am not confident in adding the code to the header files. Is there a lib that you know of that can handle this?

Yes it is but it does not work

Trivial means very simple.

Serial.print(',,');
Serial.print(Mapped_Aux1);
Serial.print('/');
Serial.print(Mapped_Aux3);
Serial.print('/');
Serial.print(Mapped_Gear);
Serial.print('/');
Serial.print(Mapped_Flaps);
Serial.print('/');
Serial.print(WF_C);
Serial.print('/');
Serial.print(WF_WL);
Serial.print('/');
Serial.print(WF_FUF);
Serial.print( '/');
Serial.print(LG_UD);
Serial.print('/');
Serial.print(LG_Doors);
Serial.print('/');
Serial.print(LG_BOF);
Serial.print('/');
Serial.print(CF_Pos);
Serial.print('/');
Serial.print(CF_AM);
Serial.print('/');
Serial.print(E_Temp);
Serial.print('/');
Serial.print(E_Choke);
Serial.print('/');
Serial.print(E_Imomb);
Serial.print('/');
Serial.print(E_Starter);
Serial.print('/');
Serial.print(C_OC);
Serial.println(',');

Note, though, that the first line won't do what you expect.

Blatantly obvious/simple same sort of thing.

Yes that is exactly what I had originally. However as you and I have both stated that the first line is all messed up and this is causing problems. After the first line all works fine.
I am also researching how to fix this at the other end by adding a handler for a Null value received.

Serial.print(',,');

11308

",," is what actually needs to be printed as "," and "/" are where the data is split when it is received.

",," is what actually needs to be printed

So, why don't you print ",," ?

I did. Still does not work.

Still does not work.

OK, you've told us what it doesn't do (whatever "work" means), how about you tell us what it does do?
And show your code.

not work means it does not do as it suppose to!

What it does with the following code

    //Send info over serial coms 
    Serial.print(",,");
    Serial.print(Mapped_Aux1);
    Serial.print("/");
    Serial.print(Mapped_Aux3);
    Serial.print("/");
    Serial.print(Mapped_Gear);
    Serial.print("/");
    Serial.print(Mapped_Flaps);
    Serial.print("/");
    Serial.print(WF_C);
    Serial.print("/");
    Serial.print(WF_WL);
    Serial.print("/");
    Serial.print(WF_FUF);
    Serial.print("/");
    Serial.print(LG_UD);
    Serial.print("/");
    Serial.print(LG_Doors);
    Serial.print("/");
    Serial.print(LG_BOF);
    Serial.print("/");
    Serial.print(CF_Pos);
    Serial.print("/");
    Serial.print(CF_AM);
    Serial.print("/");
    Serial.print(E_Temp);
    Serial.print("/");
    Serial.print(E_Choke);
    Serial.print("/");
    Serial.print(E_Imomb);
    Serial.print("/");
    Serial.print(E_Starter);
    Serial.print("/");
    Serial.print(C_OC);
    Serial.println(",");

is print a first line as: 1/0/0/1/0/0/1/1/0,
second line and subsequent lines as: ,,0/0/0/0/0/1/0/1/1/0/0/1/-273/0/1/1/0,

The second and following lines are correct the first is missing data. I want to figure out how to prevent this data from being missed in the first line.

I want to figure out how to prevent this data from being missed in the first line.

Hop on over to http://snippets-r-us.com, then. They are wizards with snippets. Here, we need to see ALL of your code.

Thanx for the help PaulS.
Dont see how the rest of my code will change anything all variables there are ints as stated before. What we are problem solving here has nothing to do with the rest of the code. But since you always insist on seeing all the code. Tell me how to attach my code which has multi tabs (25 to be exact) and is 51,480 bytes long and I will do so.

Dont see how the rest of my code will change anything

No, we don't see the rest of your code either.

Tell me how to attach my code which has multi tabs (25 to be exact) and is 51,480 bytes long

What a good thing you found this problem before the code got too big.

So tell me how to upload it!

Size of code is not a problem, code could be as follows and I would still have the same problem.

int a = 10;
int b = 22;
int c = 34;

void setup(){
  Serial.begin(9600);
}

void loop(){
  Serial.print(",,");
  Serial.print(a);
  Serial.print("/");
  Serial.print(b);
  Serial.print("/");
  Serial.print(c);
  Serial.println(",");
}

And guess what first line is still messed up. After that remaining lines are fine. Same problem as I am having.
Why people get caught up in the size of the code and wanting to see all of it is beyond me some times.
Also the rest of the code works fine and as intended.

And guess what first line is still messed up.

Try a small delay() after Serial.begin().

Why people get caught up in the size of the code

Because you should be testing as you go. If the data output is incorrect, adding 12 more tabs and 40,000 lines of code isn't going to make it better.

and wanting to see all of it

Suppose that the suggestion to add a small delay() after begin() works (as I suspect that it will). I'd look silly making that suggestion if you already had a delay(1000) after Serial.begin(), wouldn't I?

How the hell are we supposed to divine that, if you don't post all of your code?

You came here for help. We didn't come to you.

here's the messed-up output from when I ran your sketch

,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,
,,10/22/34,

Because you should be testing as you go.

I have been testing everything that I could as I go hence why the rest of the code works fine.

Try a small delay() after Serial.begin().

I done as you suggested.

Serial.begin(9600);
  delay(1000);

It did make a difference however it seem that a few bytes still get through the serial port before the delay. It then prints a full line on the first line after these few bytes then goes onto print as it should.
1/0,,0/0/0/0/0/1/0/1/1/0/0/1/0/0/1/1/0,
is now what is received on the first line.
The 1/0 at the start gets through (this varies up to 4 bytes so far) then there is the delay (it does not seem to matter what the delay is, have tried 300, 1000, 1500 and 3000) then the ,,0/0/0/0/0/1/0/1/1/0/0/1/0/0/1/1/0, comes through on the same first line and then on subsequent lines.

You came here for help. We didn't come to you.

Yes I did and not for the sarcasm etc

It did make a difference however it seem that a few bytes still get through the serial port before the delay.

What is on the other end? Perhaps the problem is on that end.