Hi...!
Now, I am using Arduino nano and facing with a problem. When I run a program, the Arduino nano stop working after 19 second and it rework after 5 second. So, please share me how to solve this problem. Thank you.
Hi...!
Now, I am using Arduino nano and facing with a problem. When I run a program, the Arduino nano stop working after 19 second and it rework after 5 second. So, please share me how to solve this problem. Thank you.
ps, interesting way of blinking the LED. Doesn't block the main thread that way 
For testing, maybe try the more basic form of Blink?
(From Arduino IDE - File - Examples - Basic - Blink)
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
-Nico
I have a feeling it's a problem with the board, or maybe a problem with the power source.
The blink example should run as long as it's plugged in.
If you have a second board, try using that to see if all is fine there.
Or, try powering the board using something else - maybe a cell phone charger if you have one.
-Nico
Honestly, I am at beginner level. So I tested with two simple LED codes.
The first one is
class Flasher
{
int ledPin;
long OnTime;
long OffTime;
int ledState;
unsigned long previousMillis;
public:
Flasher(int pin, long on, long off)
{
ledPin = pin;
pinMode(ledPin,OUTPUT);
OnTime = on;
OffTime = off;
ledState = LOW;
previousMillis = 0;
}
void Update()
{
unsigned long currentMillis = millis();
if((ledState == HIGH) && (currentMillis-previousMillis>=OnTime))
{
ledState = LOW;
previousMillis = currentMillis;
digitalWrite(ledPin,ledState);
}
else if ((ledState == LOW) && (currentMillis-previousMillis>=OffTime))
{
ledState = HIGH;
previousMillis = currentMillis;
digitalWrite(ledPin,ledState);
}
} };
Flasher led1(9,100,150);
void setup()
{
}
void loop()
{
led1.Update();
}
And the second is
void setup()
{
pinMode(9,OUTPUT);
}
void loop()
{
digitalWrite(9,HIGH);
}
Thank you for your help.
It sounds like you might have a cold solder joint or other defect.
DAB
That doesn't really help. Please post your code and a schematic if you want help.
I used blink example code from arduino.
And I also gave HIGH to pin 13 for limitless time without delay.
Totally agree. We can't really help you without seeing your code and/or a schematic.
Hi ayechan
We obviously need to see your code before we have the remotest chance of helping you 
Neil