Go Down

Topic: Problems with Serial writing in loop (Read 1 time) previous topic - next topic

cheesetornado

Hi there,

I've got a big (and bad) problem  :(

I played a bit around with my Arduino Duemillanove and than I made a big mistake, I uploaded this sketch:
Code: [Select]

// WARNING: THIS CODE IS EVIL!!! DON'T UPLOAD IT TO YOUR ARDUINO!!!
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  // [...] here was some code, which is really really fast executed
  Serial.write("Hello World");
}


Now, I think you can see my mistake. Everytime when loop is called, it tries to write "Hello World" to the USB Serial.
Ok, that doesn't sound bad, It's much times worse than you think; I can't anymore connect to the socket of the Arduino, I tried to reboot it already hundreds of times, without any success. :(
My other problem is, that I haven't got any possiblity for reprogramming the ATmega with the Header PINs, because I haven't got any tools in this relation and I haven't got any other ATMega.

Please help me, with my stupid problem.

Thanks.

johnwasser

Try this:

Unplug the USB cable.
Hold down the reset button of the Arduino.
Plug in the USB cable.
Click on the 'upload' button to upload a new sketch.
When you see "Binary sketch size" in the IDE, release the reset button of the Arduino.

I hope that will keep the Arduino from flooding the USB buffers before you can upload a sketch.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

mrtaylor

Just hit the reset button right after it finishes compiling.  The timing of pressing the button will vary.

cheesetornado

@johnwasser

Thousand thanks. That really worked.  :D
And I tried to press the reset button in the right moment ... :smiley-roll:

That was some of the things, I will never do again with my Arduino  :)

johnwasser


@johnwasser

Thousand thanks. That really worked.  :D


I suspect that the flood of characters from the Arduino sketch was interfering with the upload process.  Even though avrdude will signal the Arduino to auto-reset if it doesn't flush the received USB data it won't see the expected replies.  That's why you might need to keep the Arduino in Reset until the upload is ready.

Now that you know how to fix it you don't have to worry about getting stuck that way again. :)
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up