Serial hangs after digitalWrite()

Hope I post to the right forum...

In order to be able to debug my programm I have disabled auto reset as described here: (Arduino Playground - HomePage)

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

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.

Thanks for answering

  1. 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... :frowning:

  2. Well...

#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,

Code snippets are rarely useful.

The problem isn't there. Post all your code.

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

Cheers,
Kari

maozet:
3) Well...

#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.

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?

The simple way to find out is to disconnect whatever it is and see if it still hangs.