I am using Atmega328p with 5V power supply, My Arduino getting hangs [or auto restarts] after some times.
I am using libraries:
- Wire.h
- CRC32.h
- EEPROM.h
- Arduino.h
- TimerOne.h
- RtcDS3231.h
- SoftwareSerial.h
- Adafruit_NeoPixel.h
- avr/wdt.h
I have tried to search, some people are deny to use software serial library.
-
it's possibly some error in your codeJaromanda X– Jaromanda X2019年01月15日 05:17:11 +00:00Commented Jan 15, 2019 at 5:17
-
This is my code, can you guide me... github.com/savaliyadnk/arduinoswitchDharmendra Savaliya– Dharmendra Savaliya2019年01月15日 05:30:24 +00:00Commented Jan 15, 2019 at 5:30
-
don't use String. use C strings (zero terminated char array) majenko.co.uk/blog/evils-arduino-stringsJuraj– Juraj ♦2019年01月15日 05:45:40 +00:00Commented Jan 15, 2019 at 5:45
-
1That is only a minimal circuit in theory. Can you show us a photo? We like to see where the decoupling capacitors are and how close the crystal with the 22pF capacitors to the atmega328p is.Jot– Jot2019年01月15日 05:50:23 +00:00Commented Jan 15, 2019 at 5:50
-
Do you have 100nF connected to aref and vcc? It should be to gnd. All gnd and all vcc should be connected to the power. All of them. You have no decoupling capacitors. They are not an optional extra according to this page: gammon.com.au/bootloaderJot– Jot2019年01月15日 22:32:02 +00:00Commented Jan 15, 2019 at 22:32
1 Answer 1
Not sure if this will fix your problem, but this is a major error:
char buf1[8], buf2[6];
sprintf(buf1, "%08lu", myvote.mydate);
sprintf(buf2, "%06lu", myvote.mytime);
Take a look at sprintf function reference
A terminating null character is automatically appended after the content.
So, the text buffers are too small. It should be at least:
char buf1[9], buf2[7];