Atmel mega 328p LED blinking

I tried to light up or blink a led on my atmel mega 328p au 1437 board. Unfortunately I couldnt do it. I tried it with arduino and with microchip studio, but none of them working. I tried a lot of yt toturial code without any luck. for example I tried the following code:

const int ledPin = LED_BUILTIN;

int ledState = LOW;
unsigned long previousMillis = 0; 
const long interval = 1000;  

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {

  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;

    if (ledState == LOW) {
      ledState = HIGH;
    } else {
      ledState = LOW;
    }
    digitalWrite(ledPin, ledState);
  }
}

And I got the following error:

Sketch uses 860 bytes (2%) of program storage space. Maximum is 30720 bytes.
Global variables use 15 bytes (0%) of dynamic memory, leaving 2033 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x80
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x80
Failed uploading: uploading error: exit status 1

Anybody could tell me what should I do or can give me a code that works.

Your help will be greatly appreciated!

Thanks for everybody!

Im running it on windows 10
Im using this board: Arduino A000005 Panel Nano Core, Nano ATMega328 vásárlása - Conrad Electronic
I connected it with a usb

Are you sure the USB cable is a full USB cable, not a charger cable? i.e. does it work with other Arduinos?

Did you select in the IDE the NANO board and the correct port?

yeah, thats the only Serial port in the PC that I use

yes, it works with other arduinos. Thats why I confused

There are several layers of common problems in the PC-> Arduino connection, that's just one of them.
Is the port correct and working in Windows? (COMX, no exclamation mark)
Is the driver correct?(FT232, CH340)
Is the IDE using the correct port?(Same COM as above)
Is the USB cable connected, and known to be good?
Is the correct device selected? (Tell the IDE it's a Nano, not a Mega, for example)
Is the correct processor for the correct device selected? (328 vs 168, both could be correct)
Is the correct version of the bootloader selected? (new vs old bootloader)
That's a start. I'm sure there are other gotchas; can't remember them now.
(Some of the above doesn't apply).
Is the power LED on on your Board?

Off Topic

Hope you didn't use the ...

https://en.m.wikipedia.org/wiki/Dirty_Hungarian_Phrasebook

:slight_smile: :wink:

yeah the port is working.
Yeah the driver is correct.
Yeah ir's using the correct port.
Yeah it's connected, cause other programs work.
I selected Arduino Board Nano.
The processor is correct too.
Actually, where can I choose thhe bootloader, cause I didn't found option named bootloader. (But I tried burn bootloader, still got the same problem)
Yeah the LED is on.

Look under Processor.

in the IDE, not on your desk. Just for clarity.

hmmm, actually, im not sure
I will try it out

  • Open Arduino IDE
  • Choose Menu Tools
  • Choose Submenu Processor
  • Select ATmega328p (Old Bootloader)

There are many, many references to choose from when looking for the CH340 driver; I usually use one referenced by one of the Nano clone vendors on Amazon, as they have a vested interest in getting their hardware to work; expecting some yt artiste to vet a source is asking for trouble.

Now my program uploads but my LED doesn't want to light up.
Anybody could link me or paste a code that would light my LED?
I would be rly grateful for it.

A different code won't help you, that code should work. Caveat - we still know virtually zero about that board, as the link you posted goes to a foreign language page. Sorry, but that's where my help stops.
Good luck!

The most likely thing at this point is that the builtin LED is broken, misconnected, or not on the LED_BUILTIN pin as expected.
Instead of using LED_BUILTIN, try connecting an external LED (plus resistor) to one of the other pins (and changing your code to match.)

Hi @porgrammer,

from the datasheet in English it looks as you have a standard Arduino NANO or at least a clone.

The easiest and quickest possibility to check a sketch is to test it in the simulator Wokwi:

See here for your sketch from your post #18:

https://wokwi.com/projects/372783208575588353

This is a simple modification that you can use to test your hardware:

https://wokwi.com/projects/372783271506927617

The setup is very simple:

The red Led is connected to D13 (the same pin where the internal Led is connected to) and the green Led to pin 12. The Leds are switched on or off at the same time.

Make sure to use a resistor (180 Ohm...1kOhm) with the Leds to protect your Arduino as in the screenshot.

You may start with just the red Led (the color is actually irrelevant) connected to D13.

Good luck!

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