Hello, I'm trying to make a digit wich adds up with a really small number every milisecond but it seems like double
can't work with enough digits to do this what do I have to use to fix this?
double test;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
double test = (test + 0.0001);
Serial.println(test);
delay(1);
}
But also look up the accuracy of floating point numbers...
lenny227:
Hello, I'm trying to make a digit wich adds up with a really small number every milisecond but it seems like double
can't work with enough digits to do this what do I have to use to fix this?
you already have a built in counter of milliseconds.... millis()
You're also creating a new variable named "test" inside loop(). Its value is forgotten when loop() ends.