tjsharpe777
Member
Code:
int led = 13;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
digitalWrite(led,LOW);
}
void loop() {
// put your main code here, to run repeatedly:
unsigned long ii=1200000000000;
long jj = 1;
// 536870912
// 1073741824
// 4294967296
// long aa=0;
while(jj>0){
digitalWrite(led,HIGH);
//delay(500);
for (unsigned long i = 0 ; i < ii ; i++)
{
// aa=1;
}//end of i
digitalWrite(led,LOW);
//delay(500);
for (unsigned long j = 0 ; j < ii ; j++)
{
// aa=1;
} //end of i
}// end of while
}// end of loop()
I tried to count at 600Mhz ( or as fast as allowable). When I ran this code with the delays active and the counting loops commented out, it worked fine. Using the count loops, the LED lit bright for two seconds and just went to a continuous dim. 1.2 E9 counts should be 2 seconds ( at least) for up and down. Any help is appreciated.
Question 2 does i++ work wit long long int's?
Thanks!
Tim
int led = 13;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
digitalWrite(led,LOW);
}
void loop() {
// put your main code here, to run repeatedly:
unsigned long ii=1200000000000;
long jj = 1;
// 536870912
// 1073741824
// 4294967296
// long aa=0;
while(jj>0){
digitalWrite(led,HIGH);
//delay(500);
for (unsigned long i = 0 ; i < ii ; i++)
{
// aa=1;
}//end of i
digitalWrite(led,LOW);
//delay(500);
for (unsigned long j = 0 ; j < ii ; j++)
{
// aa=1;
} //end of i
}// end of while
}// end of loop()
I tried to count at 600Mhz ( or as fast as allowable). When I ran this code with the delays active and the counting loops commented out, it worked fine. Using the count loops, the LED lit bright for two seconds and just went to a continuous dim. 1.2 E9 counts should be 2 seconds ( at least) for up and down. Any help is appreciated.
Question 2 does i++ work wit long long int's?
Thanks!
Tim