Hello Arduinios!
I'm new here (three days) but the virus is planted - Arduino will not go out of my life...
To not to interrupt the loop() I do not place delay-statements.
Instead, I take the current micros in the loop, and then check in the subroutines/functions, if the timestamp of the last execution has passed a certain amount of time before I reexecute the function.
This amount of time I store in a variable of datatyp long. Because I'd like to quickli see how long the delay will be, I begann to notate the initialisation as follows:
static long WhatEver = 1000 * 1000 * 60Â // the main-loop is made to take micros() - this way I see, that this function should run ca. every 60sec
After some hours of debugging I discovered why my programm didn't run as expected:
 void test(long testit) {
 long Delay1 = 1000000;
 long Delay2 = 10 * 100000;
 long Delay3 = 100 * 10000;  // not a good idea...
 long Delay4 = 1000 * 1000;  // not a good idea...
 long Delay5 = 10000 * 100;  // not a good idea...
 long Delay6 = 100000 * 10;
 long Delay7 = 1000000 * 1;
 long Delay8 = 1000000 * testit;
 long Delay9 = 100000 * testit;
 long DelayA = 10000 * testit;
 long DelayB = 1000 * testit;
 long DelayC = 100 * testit;
 long DelayD = 10 * testit;
 long DelayE = 1 * testit;
Â
 long DelayF = testit * 10000;
 long DelayG = testit * 1000;
 long DelayH = testit * 100;
 long DelayI = testit * 10;
 long DelayJ = testit * 1;
 long a1 = 1;
 long a2 = 10;
 long a3 = 100;
 long a4 = 1000;
 long a5 = 10000;
 long DelayK = 10000 * a1;
 long DelayL = 1000 * a2;
 long DelayM = 100 * a3;
 long DelayN = 10 * a4;
 long DelayO = 1 * a5;
Serial.print("----Delay 1 : ");
Serial.println(Delay1);
Serial.print("----Delay 2 : ");
Serial.println(Delay2);
Serial.print("----Delay 3 : ");
Serial.println(Delay3);
Serial.print("----Delay 4 : ");
Serial.println(Delay4);
Serial.print("----Delay 5 : ");
Serial.println(Delay5);
Serial.print("----Delay 6 : ");
Serial.println(Delay6);
Serial.print("----Delay 7 : ");
Serial.println(Delay7);
Serial.print("----Delay 8 : ");
Serial.println(Delay8);
Serial.print("----Delay 9 : ");
Serial.println(Delay9);
Serial.print("----Delay A : ");
Serial.println(DelayA);
Serial.print("----Delay B : ");
Serial.println(DelayB);
Serial.print("----Delay C : ");
Serial.println(DelayC);
Serial.print("----Delay D : ");
Serial.println(DelayD);
Serial.print("----Delay E : ");
Serial.println(DelayE);
Serial.print("----Delay F : ");
Serial.println(DelayF);
Serial.print("----Delay G : ");
Serial.println(DelayG);
Serial.print("----Delay H : ");
Serial.println(DelayH);
Serial.print("----Delay I : ");
Serial.println(DelayI);
Serial.print("----Delay J : ");
Serial.println(DelayJ);
Serial.print("----Delay K : ");
Serial.println(DelayK);
Serial.print("----Delay L : ");
Serial.println(DelayL);
Serial.print("----Delay M : ");
Serial.println(DelayM);
Serial.print("----Delay N : ");
Serial.println(DelayN);
Serial.print("----Delay O : ");
Serial.println(DelayO);
Â
}
The arduino seams to interpret my 1000 * 1000 as BIN (or whatever) and calculates the result not to what I tried to do...
Is that:
- my fault (shoulden't I initialize a variable this way)?
- a missinterpretation of the IDE 1.0.1 ?
- a fault in the arduino leonardo V3?
It's not realy a problem - just a little question in the faszinating univers of Arduino!! ;-))
Thank you
Thomas
ps: sorry about my english....