Arduino Forum

Using Arduino => Programming Questions => Topic started by: frenzal_dude on Oct 11, 2011, 06:01 am

Title: Writing To Console
Post by: frenzal_dude on Oct 11, 2011, 06:01 am
Hi,
how can I write text to the black error output section at the bottom of the Arduino IDE? is it possible?
I just want to be able to view the state of my variables etc.
I read about Serial.print etc but it doesn't explain much about where you can see the text.

Thanks in advance.
Title: Re: Writing To Console
Post by: Grumpy_Mike on Oct 11, 2011, 06:23 am
Serial.print output will appere in the monitor window, click the rightmost icon on the window bar of the arduino window.
You can't get the arduino to write in that other place.
Title: Re: Writing To Console
Post by: frenzal_dude on Oct 11, 2011, 06:27 am
I tried this just for a test but nothing came up in the window, what am I doing wrong?

Cheers again.

void setup() {
  Serial.print("test");
...
Title: Re: Writing To Console
Post by: PaulS on Oct 11, 2011, 11:29 am
Quote
what am I doing wrong?

Posting snippets, instead of all of your code.
Failing to use Serial.begin() to specify a baud rate and initiate the serial port.
Who knows what else.
Title: Re: Writing To Console
Post by: stutteringp0et on Nov 22, 2014, 01:43 am
I ran into this topic because I had the same question.  The vague sort-of answer at the end left me to explore the example code to find the answer.

In setup(), start serial and choose your speed:

Serial.begin(9600);

Wherever you want to write to serial:

Serial.write("write this");

Wherever you want a newline:

Serial.println();

Everyone learns somewhere, why not make this a friendly place?
Title: Re: Writing To Console
Post by: PaulS on Nov 22, 2014, 01:12 pm

Quote
Wherever you want a newline:
Code: [Select]
Serial.writeln();

Which will produce a compiler error, since there is no writeln() method in the HardwareSerial class or in anything it derives from.

Quote
why not make this a friendly place?
We do, if people follow some simple guidelines, like reading the How to post in this forum sticky and posting ALL of their code.

We don't, especially, given just an incorrectly posted two line snippet.
Title: Re: Writing To Console
Post by: stutteringp0et on Nov 24, 2014, 07:12 am
How incredibly thoughtful of you to point out that I made a mistake and to NOT give the correct method name.  It would've been unfortunate for anyone to have learned an actual answer from this thread.

Fixed my mistake, sorry I wrote the wrong method name - Serial.writeln() vs Serial.println() is a small error in the grand scheme of what I was trying to do, which was give an actual answer where only snark had existed before.
Title: Re: Writing To Console
Post by: BulldogLowell on Nov 24, 2014, 08:29 am
We don't, especially, given just an incorrectly posted two line snippet.
I guess he's referring to the Royal "we"

make sure you are setting the baud rate in the Serial Monitor to the same number in your sketch (here 115200)

Code: [Select]

int myInt = 20;
unsigned long myTimeStamp = 1416813706;
const char *myCharArray = { "This is myCharArray"};
float myFloat = 3.14159265359;

void setup()
{
  Serial.begin(115200);
  Serial.print(myInt);
  Serial.print(myTimeStamp);
  Serial.print(myCharArray);
  Serial.print(myFloat, 6); //prints to six places right of the decimal
}
void loop()
{
  
}
Title: Re: Writing To Console
Post by: Robin2 on Nov 24, 2014, 09:09 am
I ran into this topic because I had the same question.  The vague sort-of answer at the end left me to explore the example code to find the answer.
Reply #1 had a complete answer to the original question which, as far as I can see, was different from yours.

Your code does not address the original question.

And I think Serial.print() and .println() are adequately covered in the Reference pages.
I think it is reasonable to expect people to read them before posting questions.

...R
Title: Re: Writing To Console
Post by: mikehoover on Feb 18, 2015, 07:32 pm
In the Arduino environment, choose: "Tools -> Serial Monitor" from the menu and a console window will open and your output should display there. It did not output to the black status area at the bottom of the sketch window.
Title: Re: Writing To Console
Post by: ravisravis on Jan 21, 2016, 08:52 pm
void setup() {
  // put your setup code here, to run once:
  Serial.begin(SERIAL,9600);
  Serial.println("Hello World");
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(" Hello World ");
  delay(2000);
 
}

I fire up the serial monitor (already set to 9600) but don't see anything printed there. But I see the scroll tab move, so I guess something is happening.
Title: Re: Writing To Console
Post by: Delta_G on Jan 21, 2016, 08:56 pm
Code: [Select]
Serial.begin(SERIAL,9600);

Should be:

Code: [Select]
Serial.begin(9600);
Title: Re: Writing To Console
Post by: ravisravis on Jan 21, 2016, 09:26 pm
Thanks...I should cut and paste more ...
Title: Re: Writing To Console
Post by: Delta_G on Jan 21, 2016, 09:51 pm
Thanks...I should cut and paste more read the references ...
Title: Re: Writing To Console
Post by: tanzz on Jul 31, 2016, 08:22 am
Hi,
how can I write text to the black error output section at the bottom of the Arduino IDE? is it possible?
I just want to be able to view the state of my variables etc.
I read about Serial.print etc but it doesn't explain much about where you can see the text.

Thanks in advance.
Write and build code below:

Code: [Select]
void setup() {
Serial.begin(9600);
}

void loop() {
 Serial.println(" Hello World ");
 delay(2000);
}


After that click Arduino IDE:
Tools > Serial Monitor


Good Look!
Title: Re: Writing To Console
Post by: Robin2 on Jul 31, 2016, 09:51 am
@tanzz, you need to check dates before you reply. Your Post is 5 years too late.

...R