Go Down

Topic: The Arduino uno Takes 20 seconds to start (Read 183 times) previous topic - next topic

vortix2950

Sep 20, 2019, 07:09 am Last Edit: Sep 20, 2019, 07:14 am by vortix2950
im Have a strange issue with my arduino Uno. it seems to work normally but 15 second in, it starts running really quickly. i set up a timer loop using milis and it runs once every 5 sesconds like it should but suddenly, it starts running 100 times+ a second. massive amount of prints occur.

i thought it was my code but i commented everything out. only loop variables and serial.begin();

whats odd is that if i do this in an empty sketch, its fine but if i use my sketch with everything commented out, this problem occur. Any ideas?
any by eveything commented out i do mean everything. not even global vars. everything except loop var and serial.begin().

i even went all out and deleted everything instead of commenting it out. still same.  i Ended up  copying the code to  a new sketch, but nothing. any ideas?

Code: [Select]

loop(){

  MessTime=millis();
  
  if(MessTime-HoldTime>interval){
      HoldTime=MessTime;
 
      }

  }
  

sterretje

That code will not tell you what is going on.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

spycatcher2k

Post a sketch that shows this - make it the smallest one you find show this behaviour.
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

vortix2950

Post a sketch that shows this - make it the smallest one you find show this behaviour.
its all good. the Problem was that i used int instead of unsigned  longs. seems to  work  after changing that

Budvar10

But where you used int? Please, be more specific about your mistake. It can be helpful for other people.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

DrAzzy

This example demonstrates why you should always post full sketches too - as the problem is obvious from the full sketch, with variable declarations, but not visible in the snippet you posted.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

vortix2950

#6
Sep 21, 2019, 01:48 am Last Edit: Sep 21, 2019, 01:50 am by vortix2950
But where you used int? Please, be more specific about your mistake. It can be helpful for other people.
i defined MessTime,HoldTime and interval as global ints and they should be unsigned longs.


Go Up