L led, and TX, RX lamps resetting void Loop

Hi First time user of Arduino, I just bought an Elegoo Uno R3 as a kit. I have followed a simple online tutorial to flash LEDs in order. But every 15-20 seconds L, TX, RX LEDs on the board flash and reset the loop.

This is only when its plugged in to the USB of my laptop. When the (fresh out of the box) 9v battery power is connected (and the usb is disconnected) the L LED flashes at high frequency and the program will not run. As soon as I disconnect the battery and plug in the USB it starts the program as desired but resets when the L, TX, RX LEDs on the board flash.

Is this a hardware issue? should I be complaining to the supplier?

Many Thanks

Code just in case,

int yLED=12;
int gLED=11;
int rLED=10;
int fDELAY=5000;

void setup() {
  // put your setup code here, to run once:

pinMode (10,OUTPUT);
pinMode (11,OUTPUT);
pinMode (12,OUTPUT);
pinMode (13,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(13,LOW);
digitalWrite(rLED,HIGH);
delay(500);
digitalWrite(rLED,LOW);
delay(500);

digitalWrite(yLED,HIGH);
delay(500);
digitalWrite(yLED,LOW);
delay(500);

digitalWrite(gLED,HIGH);
delay(500);
digitalWrite(gLED,LOW);
delay(fDELAY);
}

There are at least 3 things that you should do

1 - post your code following the advice in How to get the best out of this forum, especially the part about using code tags

2 - post a schematic of your project. A 'photo of a hand drawn schematic is good enough

3 - do not to expect a PP3 battery to be a satisfactory power source for long, if at all

Thanks please see schematic, as requested.

Your code and schematic look good to me.

Can you post a photo of how you have everything connected? Make sure the photo clearly shows the wiring.

It could be a laptop problem. Try with the Arduino only with the Blink sketch

Hello
Check the battery.
The battery seems to be discharged.

The problem seems to be this:"But every 15-20 seconds L, TX, RX LEDs on the board flash and reset the loop"
Probably the Uno is continuously recognized and connects and disconnects cyclically.

I would make the testing a bit more complete.

With laptop and only USB connected to the board (no leds)

  1. Start with the empty sketch (blank). Does the reset behaviour happen? If not, to (2).
  2. @speedyant's suggestion to test with the blink sketch. Does the reset behaviour happen? If not, to (3).
  3. Led plus resistor to pin 13; test with the blink sketch. Does the reset behaviour happen?

Hi All,
thanks for your support.
I noticed late last night that, when I closed the laptop screen (not shut down the laptop), with the board still connected to the USB port, the problem stopped, and the loop ran without issue. I assume the the issue is with my laptop continually addressing the board.
I think @speedyant has hit the nail on the head.

Is there away to prevent the laptop continuously recognising and connecting and disconnecting cyclically?

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