Go Down

Topic: Serial hangs after digitalWrite() (Read 1 time) previous topic - next topic

maozet

Hope I post to the right forum...

In order to be able to debug my programm I have disabled auto reset as described here: (http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection)

This works BUT hangs when my programm execute the line:
digitalWrite();

I then have to navigate to Tools->Serial Port and choose again my serial port
Then I am able to choose Serial Monitor again and to see the output (arduino doesnt hangs).

I am using UNO v3 connected to http://www.amazon.com/gp/offer-listing/B0057OC5O8/ref=dp_olp_new_mbc?ie=UTF8&condition=new

Any points?

Regards,

Maoz

pwillard

You have left out a lot of information.

1) Posting your code always helps
2) Why do you need to disable auto-reset?
3) digitalWrite(pin,value) is the correct format, but you are not showing us the PIN or VALUE you use to make it fail.
4) Debugging is designed to work over the serial connection and there is seldom a case where the reset that occurs creates hassle.


maozet

Thanks for answering

2) I want to debug my program from time to time. The arduino controls an engine (depends on weather) and I need to see the output from time to time and it should be continuous. If I won't use it then connecting reset my UNO... :-(

3) Well...
Code: [Select]

#define UP_OUTPUT 8
#define DOWN_OUTPUT 7

void goUP() {
  digitalWrite(UP_OUTPUT, LOW);
  delayMicroseconds(100);
  digitalWrite(DOWN_OUTPUT, HIGH);
  if(debug==1) {
    Serial.println("moveUP");
  }
}



The last output i see over serial is "moveUP", then if I reconnect (serial port) then I can see it wasn't hanged.

regards,


James C4S

Code snippets are rarely useful.

The problem isn't there.  Post all your code.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

GaryP

Enough power,  and right way to power up your devices?

Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

fungus


3) Well...
Code: [Select]

#define UP_OUTPUT 8
#define DOWN_OUTPUT 7

void goUP() {
  digitalWrite(UP_OUTPUT, LOW);
  delayMicroseconds(100);
  digitalWrite(DOWN_OUTPUT, HIGH);
  if(debug==1) {
    Serial.println("moveUP");
  }
}



The last output i see over serial is "moveUP", then if I reconnect (serial port) then I can see it wasn't hanged.



Seems like a power problem to me. Whatever is connected to pin 7 does something bad when you turn it on.

In general there's no way Serial.println() can hang.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

MarkT

So the pin controls an engine.  That's going to take at a guess a relay?  You have separate power for the relay?  Proper protection diode?
[ I won't respond to messages, use the forum please ]

fungus

The simple way to find out is to disconnect whatever it is and see if it still hangs.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview