I have a simple Arduino project with an LCD , IR Sensor , Relay Module ... I'm using an arduino UNO for the project
The LED on the LCD is connected to a Digital pin that supports PWM , at some point the LED on the LCD
get's turned on , after few seconds the LED should start Dimming Slowly(Fading) ...
Well , when I run the project for the first few minutes the Arduino runs fast as it does the Loop void about 26000 times a Second ...
after few minutes the arduino starts slowing down , the slowing down part gets pretty noticeable where the arduino should dim the LED ... where it takes about 10 times the amount of time where the LCD should dim ...
most of the code is some calculation for the clock and some Counters....
it's a pretty simple code not sure why the Arduino suddenly slows down ! and most of the time the arduino runs the same code ... (few of IF conditions and the IR result ...)
he Arduino runs fast as it does the Loop void about 26000 times a Second
It does not. It calls the loop() FUNCTION over and over, as fast as it can.
Here is the Code in case needed
No. There is the code. Post it HERE if you want help here. Use Reply, not the Quick Reply field, and the Additional Options link, if your code is too long to post directly.
PaulS:
It does not. It calls the loop() FUNCTION over and over, as fast as it can.
No. There is the code. Post it HERE if you want help here. Use Reply, not the Quick Reply field, and the Additional Options link, if your code is too long to post directly.
Well about the loop running 26000 time a sec it's an approximate for my code ....
you could just ignore the number ...
and I couldn't post the code here , It exceeds the maximum characters ....
There is a prompt underneath the last post which says "Reply". Click on that and a new window appears for your reply. At the bottom of that window there is a prompt for "Attachments and other options". Click that, choose your sketch file, attach it.
I would suggest that you refactor your program to eliminate the use of the String class and replace them with c-style null terminated character arrays.
Why do you convert to String; you can just as well pass the value directly to your function.
void ProcessRemoteControl(unsigned long Alpha)
{
switch(Alpha)
{
// power button
case 0x1FE8A75:
// do something with it
...
...
break;
// OK buttoms
case 0x1FEB04F:
// do something with it
...
...
break;
// more cases here
...
...
}
}
And call it in loop withProcessRemoteControl(results.value);No need for String (capital S) or c-style string.