print instructions and getting new program on example list

Hi All, You would think a print instruction would be very important for Arduino and for any programming language for that matter as they usually start with a simple program such as "hello world".
However in the Arduino reference can't find anything on printing text and variable values in the same line. Found the answer by accident in a forum reply. This should be shown in the Arduino reference in help. I have seen that many people have been having the same problem.
Like everything else its simple when you know how in Arduino anyway. Other languages make it hard.
Do this;
Serial.print ("x=");
Serial.println(x);
x is a variable. If x happens to have the value 5 the print out in the serial monitor will be x=5 all on one line.

I have made a very good program for modulating an infrared signal at 38khz so that it has the nec coding. I want to have this included in the example programs in Arduino. How do I get this done as other people have done with the author shown on the example program? The above print statement is included.

petercl14:
I want to have this included in the example programs in Arduino. How do I get this done as other people have done with the author shown on the example program?

Arduino is not accepting any additional sketches for inclusion in the official examples. However, you are very much welcome and encouraged to share your sketches with the Arduino community.

Some of the options for doing that:


Publish it in a repository on GitHub. This is the best option if you want to enable collaboration with the community. There is some introductory information about GitHub repositories here:


Arduino Project Hub: Arduino Project Hub


Or just post it here on the forum.

petercl14:
Found the answer by accident in a forum reply.

What's so accidental about it?- you asked an explicit question and got an explicit answer about 20m later.

I guess sometimes we have to extrapolate what's in a manual, since it's literally impossible for a set of examples to cover every possible user requirement.

The Serial.print() example does clearly show how to use the "print()" form a number of times followed by the "println()" form the last time on a line. No it doesn't mix text and variables on the same line (it rather prints a row of labels at the top of a table) but jeez, how difficult can it have been to go from printing a line of variables to changing some of them to text.

Hi Basil, I asked the question on the forum, then before I had an answer I did my own research and found the answer 'accidentally' in somebody elses post maybe a year or so ago. Thus I had the answer to my question before the current answers.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.