Go Down

Topic: Code not running properly (Read 2621 times) previous topic - next topic

shocklateboy92

A little while ago, I accidentally shorted the ICSP pins on my Arduino Uno (while it was on), and I think I may have corrupted the bootloader because now my sketches won't run properly.

I would have tried burning a bootloader but I don't have an ISP. Do I have to order one, or is there any other tricks that will let me fix it?

Also, could it be anything else?
(The sketches upload fine, they just won't execute properly.)

bubulindo

This... is a hobby.

shocklateboy92

yep, they worked fine before.

Coding Badly

Quote
my sketches won't run properly

Without a description of "won't run properly" it is impossible to assign blame.

shocklateboy92

#4
Jan 12, 2011, 10:10 am Last Edit: Jan 12, 2011, 10:10 am by shocklateboy92 Reason: 1
Well, it simply does not produce the expected output for ANY of the sketches I put in there.

For example, I put in the following simple test:
void setup()
{
   pinMode(13, OUTPUT);
}

void loop()
{
   digitalWrite(13, HIGH);
   delay(500);
   digitalWrite(13, LOW);
   delay(500);
}

Instead of the light blinking, it stays on continuously.

If I upload any of my other more complicated sketches, they also cause random results.

bill2009

If the upload works ok the bootloader - which is a pretty healthy piece of code - is executing fine.

Try a sketch that just does serial prints and see if you see them in the monitor. Try blinking a different pin.

What do you mean by shorting the isp header?

Coding Badly


LED on or off...

Code: [Select]
void setup()
{
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
}

void loop()
{
  digitalWrite(13, LOW);
}

shocklateboy92

Quote
What do you mean by shorting the isp header?

I accidentally touched the pins labeled ICSP with my pliers while it was on.

Quote
LED on or off...

In that sketch, the LED stayed off.

To make sure it wasn't something wrong with my computer/OS, I tried a different one. (This time, running windows).

Everything worked properly for a little while, but then it died again :(
(Sketches now cause random results)

I uploaded a sketch with lots of Serial output, but then I just saw the letter 'ÿ' being repeated over and over again on the serial monitor.

PaulS

Quote
I uploaded a sketch with lots of Serial output, but then I just saw the letter 'ÿ' being repeated over and over again on the serial monitor.

This character is what appears when you Serial.print() a -1 as a character, which is what happens if you use Serial.print(Serial.read()) without checking Serial.available() first.

Show the code...

Grumpy_Mike

#9
Jan 13, 2011, 03:06 pm Last Edit: Jan 13, 2011, 03:06 pm by Grumpy_Mike Reason: 1
Pin 13 is part of the ICSP so if you have fried those pins that will explain why your blink will not work. Try connecting an LED (with resistor) to pin 2 to 9 and see if you can get it to blink.

shocklateboy92

Hey, though I have no clue why that simple blink sketch didn't work, the rest of my sketches were producing the wrong output due to a few logic errors around the sizeof() operator. I've fixed those and everything is working fine again.

I am terribly sorry for wasting all of your time.

Go Up