Serial Monitor Query

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
gerattricjoe
 
Posts: 8
Joined: Fri Aug 22, 2014 11:10 pm

Serial Monitor Query

Post by gerattricjoe »

My first post so please be kind my friends. I am also new to Arduino having owned one for a full 24 hours now.

I have just typed in and uploaded the Sketch "Hello World" (Arduino Lesson 4). When the Serial Moniror is invoked it prints - HelHello World! - On subsequent resets of the Ardino Uno it prints - Hello World - as expected. This problem is repeated with every upload of this Sketch. If I add a second line to the Sketch e.g. - What a nice day - this second line prints ok but the first still has the leading extra - Hel - the first time.

Is this a problem others are having or is it something at my end? I have a Mac running OS 10.9.4 and using Arduino IDE 1.0.5, I seem to recall when downloading the IDE it said something about being in beta but I may be wrong. Only a small issue but one that is bugging me. Any and all help appreciated.

User avatar
Franklin97355
 
Posts: 23938
Joined: Mon Apr 21, 2008 2:33 pm

Re: Serial Monitor Query

Post by Franklin97355 »

1.0.5 is stable now. Could you post your code and a description or drawing of your connections between it all? Please use the code button "</>" in the button bar when posting code to the forums.When you open the serial monitor it should reset the Arduino (which one do you have?) and restart the code but the monitor does not seem to be reset or the code is sending too fast. We can look when you post your code.

User avatar
gerattricjoe
 
Posts: 8
Joined: Fri Aug 22, 2014 11:10 pm

Re: Serial Monitor Query

Post by gerattricjoe »

Thanks franklin. I have a genuine Arduino Uno R3 but the SMD edition. Interconnect is a USB cable from the Mac to the Arduino. When coming back to the 'problem' I notice it is giving a different response to that described above.

Code under - Also image of monitor response below. Many thanks

Code: Select all

/*
Hello World
*
* This is the Hello World! for Arduino
* It shows how to send data to  the micro
*/

void setup()            //run once when the sketch starts
{
  Serial.begin(9600);  //  setup serial library baud rate
  
  Serial.println("Hello World!");  // prints with a line break
  
  Serial.println("what a nice day");  // prints with a line break
}
void loop()          // run over and aver
{
                     // do nothing
}

Image

User avatar
gerattricjoe
 
Posts: 8
Joined: Fri Aug 22, 2014 11:10 pm

Re: Serial Monitor Query

Post by gerattricjoe »

Oops! Image didn't seem to work, It is here:

http://d.pr/i/t1LC

User avatar
Franklin97355
 
Posts: 23938
Joined: Mon Apr 21, 2008 2:33 pm

Re: Serial Monitor Query

Post by Franklin97355 »

It works OK on my computer. Something you can try is to put a delay(500); after the Serial.begin(9600); to give it time to stabilize before printing.

User avatar
gerattricjoe
 
Posts: 8
Joined: Fri Aug 22, 2014 11:10 pm

Re: Serial Monitor Query

Post by gerattricjoe »

Thanks again franklin. A delay() of any length does nothing to help. Even a delay() before the Serial.begin has only the expected effect. Interestingly inserting the delay emphasises that the first few unwanted characters occur before the actual Serial.println command outputs to the monitor.

The action therefore is: 1) upload the sketch 2) allow time to settle 3)invoke the serial monitor. This produces the following on the screen 1) Immediate appearance of the unwanted characters 2) a delay of duration set by that command 3) the appearance of the Hello World text.

I thought for a while that the unwanted characters may have been held in a buffer somewhere from the previous transmission but ruled this out by changing the Hello to Beautiful. The first few characters in Beautiful then appeared in the next upload and invoke monitor actions.

So it seems like there are some crazy things happening with my machine. Often rebooting helps with funny little occurances like this but not in this case. Perhaps there is some logical reason for this behaviour and I might be able to find it down the track. Meanwhile, I shall just have to live with it. Again many thanks for your input.

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: Serial Monitor Query

Post by adafruit_support_bill »

It sounds like you are getting two resets when the serial monitor connects. The reset is toggled by the DTR line when the serial port is opened. I'd guess that something in they way yours is configured is toggling it twice. An oddity, but probably not a problem for most applications.

User avatar
gerattricjoe
 
Posts: 8
Joined: Fri Aug 22, 2014 11:10 pm

Re: Serial Monitor Query

Post by gerattricjoe »

How obvious it seems now that you have mentioned it.

I'll put a CRO on it tomorrow. Many thanks for the idea.

User avatar
gerattricjoe
 
Posts: 8
Joined: Fri Aug 22, 2014 11:10 pm

Re: Serial Monitor Query

Post by gerattricjoe »

Obvious it might have seemed but that's not it. Only one reset pulse exists on launching the serial monitor. There are however four or five (seemingly random) resets of the processor when uploading. I think it may have something to do with these because the unwanted characters appear immediately with the monitor window, post upload.

Can't waist any more time on it though - I will just live with it. Thanks all for your help.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”