Regarding output of " uint64_t " data type

I run code :
uint64_t randomTimer;
void setup()
{
randomTimer = 0;
Serial.begin(9600);
}

void loop()
{
randomTimer++;
Serial.println(‘randomTimer’);
delay(300);
}

but output is :
25970
25970
25970…

I use a Proteus 8 for Simulation of code. the image of code and Proteus diagram is attached.
please explained why the output is 25970 continuously.

What are the single quotes around randomTimer for?

There likely isn’t an overload of the println() method for the uint64_t data type. Probably easiest to break it into upper / lower 4 bytes and print in HEX. If you have to have decimal, more work will be required. Perhaps try the BigNumber Library.

Probably because without it the OP got...

sketch_test:12:28: error: call of overloaded 'println(uint64_t&)' is ambiguous

  Serial.println(randomTimer);

                            ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:233,

                 from sketch\sketch_test.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:80:12: note: candidate: size_t Print::println(char)

     size_t println(char);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:81:12: note: candidate: size_t Print::println(unsigned char, int)

     size_t println(unsigned char, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:82:12: note: candidate: size_t Print::println(int, int)

     size_t println(int, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:83:12: note: candidate: size_t Print::println(unsigned int, int)

     size_t println(unsigned int, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:84:12: note: candidate: size_t Print::println(long int, int)

     size_t println(long, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:85:12: note: candidate: size_t Print::println(long unsigned int, int)

     size_t println(unsigned long, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:86:12: note: candidate: size_t Print::println(double, int)

     size_t println(double, int = 2);

            ^~~~~~~
exit status 1
call of overloaded 'println(uint64_t&)' is ambiguous

As gfvalvo says, there is no println overload for uint64_t.

To the OP : Why do you need to be printing such large numbers?

wildbill: What are the single quotes around randomTimer for?

I want to print the value variable "randomTimer" which is a uint64_t data type.

pcbbc: Probably because without it the OP got...

sketch_test:12:28: error: call of overloaded 'println(uint64_t&)' is ambiguous

  Serial.println(randomTimer);

                            ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,

                from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

                from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:233,

                from sketch\sketch_test.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:80:12: note: candidate: size_t Print::println(char)

    size_t println(char);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:81:12: note: candidate: size_t Print::println(unsigned char, int)

    size_t println(unsigned char, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:82:12: note: candidate: size_t Print::println(int, int)

    size_t println(int, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:83:12: note: candidate: size_t Print::println(unsigned int, int)

    size_t println(unsigned int, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:84:12: note: candidate: size_t Print::println(long int, int)

    size_t println(long, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:85:12: note: candidate: size_t Print::println(long unsigned int, int)

    size_t println(unsigned long, int = DEC);

            ^~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:86:12: note: candidate: size_t Print::println(double, int)

    size_t println(double, int = 2);

            ^~~~~~~ exit status 1 call of overloaded 'println(uint64_t&)' is ambiguous




As gfvalvo says, there is no println overload for uint64_t.


To the OP : Why do you need to be printing such large numbers?

I have 8x8x8 led matrix code. and in that code they are using these but not print the value of randomTimer. My question is i declare a randomTimer as uint64_t data type. assign a value of "0" and the do a operation randomTimer++ (i.e randomTimer=randomTimer+1). So the output will be 1 and the 2,3,4,.....goes on. But after simulation of these first output is 25970. How it will come /

Check if the following sketch works for you to show the decimal value of an unsigned 64-bit variable starting from 1.

uint64_t randomTimer, randomTimerX;// = 0;//0xFFFFFFFFFFFFFFFF;//123456789123456789;;
byte myDigit[50];
int i = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  randomTimer++;
  showNumber();
  do
  {
    Serial.print(myDigit[i]);
    //delay(500);
    i--;
  }
  while (i != -1);
  i = 0;
  Serial.println();
  //while (1);

  delay(300);
}

void showNumber()
{
  randomTimerX = randomTimer;
  do
  {
    myDigit[i] = randomTimerX % 10;
    randomTimerX = randomTimerX / 10;
    i++;
  }
  while (randomTimerX != 0);
  i = i - 1;
}