Pages: [1]   Go Down
Author Topic: Sketches behaving differently when the SERIAL MONITOR is activie  (Read 1142 times)
0 Members and 1 Guest are viewing this topic.
Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 737
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am working on sketches and trying to find bugs/problems.

To help I put lines with Serial.print() to see what is going on.

Weirdly though if I have the machine plugged in, and run the sketch, it crashes.
However, SAME SKETCH, but no 'puta plugged in, it doesn't crash.

Well, ok, it does, but not at the same point that it did when the 'puta was plugged in monitoring.

So as an example the sketch just keeps rebooting if I have the computer plugged in.
If I unplug the machine it goes further but then hangs.

And no, Pins 0 and 1 are not being used.
(Well, not that I can see.)
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 206
Posts: 12859
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Does any data pass from the computer to the Arduino?
Logged

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 737
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No,

The sketch is uploaded and "runs".

Data is only sent from the Arduino to the PC.
Just simple prints either saying where it is or sending a bit of data so I know what is going on.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 206
Posts: 12859
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


When the board is not connected to the computer, how is it powered?
Logged

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 737
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Fair question.

External SMPS.  12v 2A.

Something else which is throwing me alonng this line is this:

Say I have a "working sketch".

Somewhere in it I put a:
Serial.print("blah blah");

When I upload it, the sketch fails.

If I remove that line, it works.


I know it sounds weird, but that is the honest truth to what I see happening.
If there are other problems in there somewhere of which I know nothing, I can't declare them here.
Logged

Offline Offline
Edison Member
*
Karma: 33
Posts: 1438
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you close to the Flash or SRAM limits?
Logged

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 737
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I really hope not.

Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7189
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I really hope not.



Just hoping is not good enough. You need this:

http://www.arduino.cc/playground/Code/AvailableMemory

You need to comment out a few long strings in your code to run this code, if your code is already running out of SRAM. What you described is very much like SRAM is running out.
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26248
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, we could debate this all day.
Or you could post code.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: