GY-63_MS5611/libraries/HT16K33/examples/test_printfloat/test_printfloat.ino

65 lines
977 B
Arduino
Raw Normal View History

2020-07-16 05:08:25 -04:00
//
// FILE: test_printfloat.ino
// AUTHOR: Rob Tillaart
2020-11-27 05:16:22 -05:00
// VERSION: 0.2.0
2020-07-16 05:08:25 -04:00
// PURPOSE: test decimal point for floats.
// URL: http://www.adafruit.com/products/1002
// URL: https://github.com/RobTillaart/HT16K33
2021-05-26 09:01:19 -04:00
2020-07-16 05:08:25 -04:00
#include "HT16K33.h"
HT16K33 seg(0x70);
2021-05-26 09:01:19 -04:00
2020-07-16 05:08:25 -04:00
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
seg.begin();
Wire.setClock(100000);
seg.displayOn();
}
2021-05-26 09:01:19 -04:00
2020-07-16 05:08:25 -04:00
void loop()
{
test_printfloat();
Serial.println("---------------");
delay(1000);
}
2021-05-26 09:01:19 -04:00
2020-07-16 05:08:25 -04:00
void test_printfloat()
{
2020-11-27 05:16:22 -05:00
for (int i = -2000; i < 2000; i++)
{
float f = i * 0.001;
seg.displayFloat(f);
delay(10);
}
2020-07-16 05:08:25 -04:00
for (int i = 9990; i < 10005; i++)
{
float f = i * 0.001;
seg.displayFloat(f);
delay(250);
}
for (int i = 930; i < 1020; i++)
{
float f = i * 0.1;
seg.displayFloat(f);
delay(250);
}
for (int i = 9995; i < 10020; i++)
{
float f = i * 0.1;
seg.displayFloat(f);
delay(250);
}
}
2021-05-26 09:01:19 -04:00
2020-07-16 05:08:25 -04:00
// -- END OF FILE --