Sketch not running

I have a very simple sketch - just a blinking LED - which is being compiled without errors.
But after uploading the sketch nothing happens. Disconnected from the IDE I checked it with
a meter and the LED blinked properly.
After uploading the sketch not even the loop is executed.
Instead, the IDE gave the following messages (in orange characters)

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "E:\myprograms\arduino-1.8.16\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM9
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Wiring
         Description     : Wiring
         Programmer Model: AVRISP
         Hardware Version: 15
         Firmware Version Master : 2.10
         Vtarget         : 0.0 V
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\Fujitsu\AppData\Local\Temp\arduino_build_728474/eineLED.ino.ino.hex"
avrdude: writing flash (2730 bytes):

Writing | ################################################## | 100% 0.45s

avrdude: 2730 bytes of flash written
avrdude: verifying flash memory against C:\Users\Fujitsu\AppData\Local\Temp\arduino_build_728474/eineLED.ino.ino.hex:
avrdude: load data flash data from input file C:\Users\Fujitsu\AppData\Local\Temp\arduino_build_728474/eineLED.ino.ino.hex:
avrdude: input file C:\Users\Fujitsu\AppData\Local\Temp\arduino_build_728474/eineLED.ino.ino.hex contains 2730 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.36s

avrdude: verifying ...
avrdude: 2730 bytes of flash verified

avrdude done.  Thank you.

any suggestions?

[sterretje edit]
Fixed the code tags. [code] should have been on its own line :wink: Thanks for your attempt to use code tags :+1:

Looks like the uploading is successful.

Post the sketch to see how we can help.

this is the sketch, very simple:

int LED1 = 7;

void setup() {
  Serial.begin(9600);
  // put your setup code here, to run once:
  pinMode(LED1, OUTPUT); 
  
}

void loop() {
  // put your main code here, to run repeatedly:
   Serial.println("AAA");
   digitalWrite(LED1,HIGH); //LED on
   delay(1000);//LED activ
    Serial.println("BBBB");
   digitalWrite(LED1,LOW); //LED off
    delay(666);   
}

Are you accidentally only hitting the verify button, not the upload button?

It happens.

a7

Hi @helmut25,

I uploaded your sketch to a MEGA2560 with a LED connected to digital pin 7 and it worked as expected.

The messages in orange are the upload messages; I get identical messages (except regarding directories or filenames which is normal).

All messages look quite ok ...

If you have not checked the Serial output but only the LED: Can it be you connected the LED to the analog 7 pin instead of digital 7 ... ?

:wink:

Can you post a schematic of how it is wired up please?
And a photorgaph so we can see the wires go to where we expect them to.

Possible faults are

  1. The connections are bad, happens alot using solder-less bread board.
  2. The LED is placed the wrong way round.
  3. The series resistor in the LED is too high to see it shining.

And …

Leds only work one way round

Disconnected from the IDE, I checked with a meter and the LED blinked properly.
So this cannot be the reason.
I will try to give a schematic or a photograph.

thanks so far!

I’m puzzled. If you mean the diode testing position of your DMM gave a ‘good’ reading, that still leaves the possibility that @hammy raised.

@Terrypin: Yes, but the messages posted tell a different story:

Writing | ################################################## | 100% 0.45s
avrdude: 2730 bytes of flash written

@helmut25:

Could you clarify

  • whether you checked the Serial output also or only the diode?
  • and what do you mean with this:

Disconnected from the IDE I checked it with
a meter and the LED blinked properly.

A "meter" usually does not "blink" an LED ...

@helmut25 you haven't addressed that question.

Also I am curious about how you test a blink with a meter. It doesn't rule out the points I made if the connections to the LED is bad, or the LED is the wrong way round.

I just found out that the ground was not properly connected.
thanks to everybody for your help, all the same!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.