6

When I used Serial.println() in the code I naively believed I would see the characters that I sent displayed on that little black area just under the interface (just like a terminal).

#include <Servo.h>
int moveServo;
Servo myservo;
void setup()
{
 myservo.attach(0);
 Serial.println(" Hello Earth");
 Serial.println();
}
void loop() {
}

Can someone tell me just where Hello Earth would be displayed?

The Guy with The Hat
5,2927 gold badges30 silver badges51 bronze badges
asked Sep 6, 2014 at 17:17

2 Answers 2

11

The IDE on your computer has a menu item under the tools menu called "Serial Monitor." On my Mac, at least, it is indeed a black area under the source editor for the current sketch.

It won't work unless you call the Serial.begin() function in your setup method before the first Serial.print()/println()/write() function call.

Something like this:

//Set up the serial port @ 9600 baud for display back to the computer
Serial.begin(9600);
delay(25);
Serial.println("Hello world!":);
answered Sep 6, 2014 at 17:52
3

You can open the serial console in the Arduino IDE by pressing ctrl-shift-M (as in Monitor) or selecting it in the menu.

Also, to use the serial interface, you have to initialize it using Serial.begin(9600); in setup() before calling any other function which writes to it. You can use any other baud rate - but this is the default in the Arduino IDE, if you change it, you should change it in the IDE too.

answered Sep 6, 2014 at 17:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.