GY-63_MS5611/libraries/HT16K33/examples/test_fixedPoint/test_fixedPoint.ino
2021-12-19 15:24:23 +01:00

79 lines
1.2 KiB
C++

//
// FILE: test_fixedPoint.ino
// AUTHOR: Rob Tillaart
// PURPOSE: test decimal point for floats.
// URL: http://www.adafruit.com/products/1002
// URL: https://github.com/RobTillaart/HT16K33
#include "HT16K33.h"
HT16K33 seg(0x70);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
if (! seg.begin())
{
Serial.println("not connected");
}
Wire.setClock(100000);
seg.displayOn();
seg.displayFixedPoint0(1.945);
delay(1000);
seg.displayFixedPoint1(1.945);
delay(1000);
seg.displayFixedPoint2(1.945);
delay(1000);
seg.displayFixedPoint3(1.945);
delay(1000);
}
void loop()
{
test_printFixedPoint();
Serial.println("---------------");
delay(1000);
}
void test_printFixedPoint()
{
for (int i = -2000; i < 2000; i++)
{
float f = i * 0.001;
seg.displayFixedPoint3(f);
delay(2);
}
for (int i = -2000; i < 2000; i++)
{
float f = i * 0.001;
seg.displayFixedPoint2(f);
delay(2);
}
for (int i = -2000; i < 2000; i++)
{
float f = i * 0.001;
seg.displayFixedPoint1(f);
delay(2);
}
for (int i = -2000; i < 2000; i++)
{
float f = i * 0.001;
seg.displayFixedPoint0(f);
delay(2);
}
}
// -- END OF FILE --