adafruit / ArduinoCore-samd

115 stars 119 forks source link

Serial.printf of uint64_t #244

Closed trlafleur closed 4 years ago

trlafleur commented 4 years ago

If I try to use Serial.printf to print two uint64_t variables, the 2nd one prints as a zero...

Arduino 1.8.13 Feather M0 Adafruit SAMD21 Boards 1.6.0

moved from (https://github.com/arduino/ArduinoCore-sam/issues/109)

void setup() {
     Serial.begin (115200);              // Initialize USB/serial connection
     delay(2000);

     Serial.printf("hello...\n");

uint64_t A = 12345678l;
uint64_t B = 87654321l;

Serial.printf ("A: %lu, B: %lu\n", A, B);

Serial.printf ("A: %lu\n", A);
Serial.printf ("B; %lu\n", B);

}

void loop() {
  // put your main code here, to run repeatedly:

}
hathach commented 4 years ago

try %llu, lu is equivalent to uint32_t on ARM. For better support, you should post this on our forum.