Skip to content

Commit b7e337e

Browse files
committed
HT16K33 - fix printFloat
1 parent 12cc97d commit b7e337e

File tree

6 files changed

+90
-31
lines changed

6 files changed

+90
-31
lines changed

libraries/HT16K33/examples/demo1/demo1.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
//
22
// FILE: 4x7segmentI2C.ino
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.0.1
4+
// VERSION: 0.1.0
55
// PURPOSE: demo
66
// URL: http://www.adafruit.com/products/1002
7-
// HISTORY:
7+
// URL: https://github.com/RobTillaart/HT16K33
88

9-
#include <Wire.h>
109
#include "HT16K33.h"
1110

12-
HT16K33 seg;
11+
HT16K33 seg(0x70);
1312

1413
uint32_t start;
1514
uint32_t stop;
@@ -20,7 +19,7 @@ void setup()
2019
Serial.begin(115200);
2120
Serial.println(__FILE__);
2221

23-
seg.begin(0x70);
22+
seg.begin();
2423
Wire.setClock(100000);
2524

2625
seg.displayOn();
@@ -127,4 +126,6 @@ void loop()
127126
}
128127
stop = millis();
129128
Serial.println(stop - start);
130-
}
129+
}
130+
131+
// -- END OF FILE --

libraries/HT16K33/examples/demo2/demo2.ino

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
//
22
// FILE: 4x7segmentI2C.ino
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.0.1
4+
// VERSION: 0.0.2
55
// PURPOSE: demo 2
66
// URL: http://www.adafruit.com/products/1002
7-
// HISTORY:
7+
// URL: https://github.com/RobTillaart/HT16K33
88

9-
#include <Wire.h>
109
#include "HT16K33.h"
1110

12-
HT16K33 seg;
11+
HT16K33 seg(0x70);
1312

1413
uint32_t start;
1514
uint32_t stop;
1615

17-
1816
void setup()
1917
{
2018
Serial.begin(115200);
2119
Serial.println(__FILE__);
2220

23-
seg.begin(0x70);
21+
seg.begin();
2422
Wire.setClock(100000);
2523

2624
seg.displayOn();
@@ -140,4 +138,7 @@ void loop()
140138
}
141139
seg.suppressLeadingZeroPlaces(0);
142140
Serial.println("\n -- DONE -- \n");
143-
}
141+
}
142+
143+
144+
// -- END OF FILE --

libraries/HT16K33/examples/demo3/demo3.ino

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
//
22
// FILE: 4x7segmentI2C.ino
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.0.1
4+
// VERSION: 0.0.2
55
// PURPOSE: demo 3
66
// URL: http://www.adafruit.com/products/1002
7-
// HISTORY:
7+
// URL: https://github.com/RobTillaart/HT16K33
88

9-
#include <Wire.h>
109
#include "HT16K33.h"
1110

12-
HT16K33 seg;
11+
HT16K33 seg(0x70);
1312

1413
uint32_t start;
1514
uint32_t stop;
@@ -21,7 +20,7 @@ void setup()
2120
Serial.begin(115200);
2221
Serial.println(__FILE__);
2322

24-
seg.begin(0x70);
23+
seg.begin();
2524
Wire.setClock(100000);
2625

2726
seg.displayOn();
@@ -37,11 +36,16 @@ void setup()
3736

3837
void loop()
3938
{
40-
// test_elsa();
41-
// test_random();
42-
// test_VULeft();
39+
// comment tests you do not want to see
40+
test_elsa();
41+
delay(100);
42+
test_random();
43+
delay(100);
44+
test_VULeft();
45+
delay(100);
4346
test_VURight();
44-
// test_VUStereo();
47+
delay(100);
48+
test_VUStereo();
4549
delay(100);
4650
}
4751

@@ -135,11 +139,11 @@ void displayVUStereo(uint8_t left, uint8_t right)
135139
break;
136140
}
137141
seg.displayRaw(ar);
138-
142+
139143
// sort of heartbeat
140144
static bool t = false;
141145
seg.displayColon(t);
142146
t = !t;
143147
}
144148

145-
// -- END OF FILE --
149+
// -- END OF FILE --

libraries/HT16K33/examples/demo_dual1/demo_dual1.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//
22
// FILE: demo_dual1.ino
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.0.1
4+
// VERSION: 0.1.0
55
// PURPOSE: demo 2 I2C 4x7segment displays one uint32_t unsigned long
66
// URL: http://www.adafruit.com/products/1002
7-
// HISTORY:
7+
// URL: https://github.com/RobTillaart/HT16K33
88

9-
#include <Wire.h>
109
#include "HT16K33.h"
1110

12-
HT16K33 left, right;
11+
HT16K33 left(0x70);
12+
HT16K33 right(0x71);
1313

1414
uint32_t counter = 0;
1515

@@ -18,8 +18,8 @@ void setup()
1818
Serial.begin(115200);
1919
Serial.println(__FILE__);
2020

21-
left.begin(0x70);
22-
right.begin(0x71);
21+
left.begin();
22+
right.begin();
2323

2424
Wire.setClock(100000);
2525

@@ -44,4 +44,4 @@ void loop()
4444
counter++;
4545
}
4646

47-
// -- END OF FILE --
47+
// -- END OF FILE --
1.2 MB
Binary file not shown.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//
2+
// FILE: test_printfloat.ino
3+
// AUTHOR: Rob Tillaart
4+
// VERSION: 0.1.0
5+
// PURPOSE: test decimal point for floats.
6+
// URL: http://www.adafruit.com/products/1002
7+
// URL: https://github.com/RobTillaart/HT16K33
8+
9+
#include "HT16K33.h"
10+
11+
HT16K33 seg(0x70);
12+
13+
void setup()
14+
{
15+
Serial.begin(115200);
16+
Serial.println(__FILE__);
17+
18+
seg.begin();
19+
Wire.setClock(100000);
20+
21+
seg.displayOn();
22+
}
23+
24+
void loop()
25+
{
26+
test_printfloat();
27+
Serial.println("---------------");
28+
delay(1000);
29+
}
30+
31+
void test_printfloat()
32+
{
33+
for (int i = 9990; i < 10005; i++)
34+
{
35+
float f = i * 0.001;
36+
seg.displayFloat(f);
37+
delay(250);
38+
}
39+
for (int i = 930; i < 1020; i++)
40+
{
41+
float f = i * 0.1;
42+
seg.displayFloat(f);
43+
delay(250);
44+
}
45+
for (int i = 9995; i < 10020; i++)
46+
{
47+
float f = i * 0.1;
48+
seg.displayFloat(f);
49+
delay(250);
50+
}
51+
}
52+
53+
// -- END OF FILE --

0 commit comments

Comments
 (0)