GY-63_MS5611/libraries/printHelpers/examples/toBytes/toBytes.ino

55 lines
922 B
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: toBytes.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo toBytes(double val);
2021-05-28 07:41:47 -04:00
2021-01-29 06:31:58 -05:00
#include "printHelpers.h"
volatile uint32_t n = 0;
2021-05-28 07:41:47 -04:00
2021-01-29 06:31:58 -05:00
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
delay(10);
Serial.println("20 random() values");
for (uint8_t i = 0; i < 20; i++)
{
n = random(PI * pow(10, i));
Serial.print(i);
Serial.print('\t');
Serial.print(sci(n, 3));
Serial.print('\t');
Serial.print(toBytes(n));
Serial.print('\t');
Serial.println();
}
Serial.println();
Serial.println("20 BIG values");
double n = PI * 12345;
for (uint8_t i = 0; i < 20; i++)
{
Serial.print(i);
Serial.print('\t');
Serial.print(sci(n, 3));
Serial.print('\t');
Serial.print(toBytes(n));
Serial.print('\t');
Serial.println();
n = n * (PI * PI * PI * PI);
}
Serial.println("\ndone...");
}
2021-05-28 07:41:47 -04:00
2021-01-29 06:31:58 -05:00
void loop()
{
}
2021-05-28 07:41:47 -04:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --