I am struggling with this 1.2" 7 segment display. I cannot control the decimals. There is a method for controlling the center colon, which I am able to use, but I also need to be able to light up the other decimals. (please note, this is not the .56" display with 4 decimals along the bottom row, this is the 1.2" display with two independently controllable decimals on the left side.
I am making a pretty basic bedroom clock and the decimals are for alarm indicators. I've included the code of my test sketch. The error I get is 'class HT16K33' has no member named 'writeDigitRaw'. It doesn't seem to let me use this method and I'm stuck.
One possibility that I am starting to consider is that i may have downloaded numerous libraries related to the HT16K33, some of which are for other displays. I wonder if somehow it's loading a wrong, similarly names file?
#include "HT16K33.h"
//the following 3 lines are for the clock display (HT16K33)
HT16K33 seg(0x70);
uint32_t start, stop;
uint8_t ar[4];
bool display_On = false;
uint8_t output[4] = {0xFF,0xFF,0xFF,0xFF};
void setup() {
Wire.begin();
Serial.begin(9600);
delay(1000);
Serial.println(__FILE__);
seg.begin();
Wire.setClock(100000);
seg.displayOn();
seg.setDigits(4);
Serial.println("displayTest()");
seg.displayTest(1);
seg.displayOff();
delay(1000);
seg.displayColon(false);
seg.brightness(0);
seg.displayOn();
}
void loop() {
//seg.displayFloat(12.34);
//seg.writeDigitNum(0,0,0);
seg.writeDigitRaw(0x02, 0x10);
seg.writeDigitRaw(2, 0x10);
//seg.writePos(2, 0x04);
//seg.print(0000);
//seg.display(output,0x3);
//seg.display(ar, 0x01);
//seg.displayInt(9999);
//seg.displayHex(0xFFFF);
//seg.displayRaw(output, 0xFF);
//seg.displayRaw(0, 5, true);
}
1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- landru428
- Posts: 8
- Joined: Thu May 05, 2022 11:15 am
- adafruit_support_bill
- Posts: 88037
- Joined: Sat Feb 07, 2009 10:11 am
Re: 1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
You need to use the correct library which is Adafruit_LEDBackpack.h : https://learn.adafruit.com/adafruit-led ... /downloads
- landru428
- Posts: 8
- Joined: Thu May 05, 2022 11:15 am
- landru428
- Posts: 8
- Joined: Thu May 05, 2022 11:15 am
Re: 1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
What a difference using the correct library makes. Thank you so much. For some reason I could not find the right one. I had to rewrite all of the display code, but it wasn't a big deal. I am, however, still having some weird issues.
The first is that still cannot control the upper left decimal. It does not light. I was able to get it to turn on when I had the wrong library, so I do not believe it is broken or mis-wired, but those are obviously possibilities.
The other issue is that when it is instructed to print an 'A', it prints a backwards 6 instead. Seems like the bitmask is wrong in the library, but I dug into the library files and as far as I could tell the bitmask was correct. It's doesn't really matter for what I want to use this display for, but I thought it was strange and might be a clue regarding the decimal.
Lastly, when I run a loop through all hex values from 0x00 to 0xff, the display behaves as expected, except for the upper decimal.
Here is the test code I'm using to run through the bitmask combinations. This code does not test for the 'A' issue.
#include <Wire.h> // Enable this line if using Arduino Uno, Mega, etc.
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_7segment seg = Adafruit_7segment();
void setup() {
Wire.begin();
Wire.setClock(100000);
seg.begin(0x70);
seg.setBrightness(15);
seg.clear();
}
void loop() {
for (uint8_t i = 0x00; i <= 0xFF; ++i) {
seg.writeDigitRaw(0, i);
seg.writeDigitRaw(1, i);
seg.writeDigitRaw(2, i);
seg.writeDigitRaw(3, i);
seg.writeDigitRaw(4, i);
seg.writeDisplay();
delay(100);
}
}
The first is that still cannot control the upper left decimal. It does not light. I was able to get it to turn on when I had the wrong library, so I do not believe it is broken or mis-wired, but those are obviously possibilities.
The other issue is that when it is instructed to print an 'A', it prints a backwards 6 instead. Seems like the bitmask is wrong in the library, but I dug into the library files and as far as I could tell the bitmask was correct. It's doesn't really matter for what I want to use this display for, but I thought it was strange and might be a clue regarding the decimal.
Lastly, when I run a loop through all hex values from 0x00 to 0xff, the display behaves as expected, except for the upper decimal.
Here is the test code I'm using to run through the bitmask combinations. This code does not test for the 'A' issue.
#include <Wire.h> // Enable this line if using Arduino Uno, Mega, etc.
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_7segment seg = Adafruit_7segment();
void setup() {
Wire.begin();
Wire.setClock(100000);
seg.begin(0x70);
seg.setBrightness(15);
seg.clear();
}
void loop() {
for (uint8_t i = 0x00; i <= 0xFF; ++i) {
seg.writeDigitRaw(0, i);
seg.writeDigitRaw(1, i);
seg.writeDigitRaw(2, i);
seg.writeDigitRaw(3, i);
seg.writeDigitRaw(4, i);
seg.writeDisplay();
delay(100);
}
}
- landru428
- Posts: 8
- Joined: Thu May 05, 2022 11:15 am
Re: 1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
For a little more context, the bad A render looks like a lower case 'a', which i found some code for in one of the libraries. Is it possible my unit is rendering the A as lowercase? Perhaps I wrote over some memory location when I was using the wrong library?
- adafruit_support_bill
- Posts: 88037
- Joined: Sat Feb 07, 2009 10:11 am
Re: 1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
Looks like there have been some changes to the library. But nothing that looks like it would cause a problem. I'll collect some parts and see if I can reproduce the issue here.
- landru428
- Posts: 8
- Joined: Thu May 05, 2022 11:15 am
Re: 1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
Thanks! I'd like to add that I got to the bottom of the 'A' problem. It's a quirk of the library, which is programmed to render the A in a lowercase fashion. Is that a thing now?
The upper left decimal is still a mystery. I can confirm that it does light up when I use the 'wrong' library, so I know it isn't burnt out or disconnected. Thanks for taking a look at it.
The upper left decimal is still a mystery. I can confirm that it does light up when I use the 'wrong' library, so I know it isn't burnt out or disconnected. Thanks for taking a look at it.
- landru428
- Posts: 8
- Joined: Thu May 05, 2022 11:15 am
Re: 1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
Sorry to bump this up again, but it turns out it was just a case of bad soldering. According to the datasheet https://cdn-shop.adafruit.com/datasheet ... asheet.pdf the DP1 LED is on it's own pin #7 and that was the whole problem. My apologies for not being thorough, but I'd also like to thank the kind people of this message board for helping me work through the problem. Anyway, if anyone is reading this in posterity, the solution was that it just needed to be soldered properly.
- adafruit_support_bill
- Posts: 88037
- Joined: Sat Feb 07, 2009 10:11 am
Re: 1.2" 7 SEGMENT DISPLAY - CAN'T CONTROL DECIMALS
Thanks for following up on that. I just got the parts together for a similar configuration this afternoon and was attempting to reproduce the problem. Good to hear that it turned out to be something simple.
Please be positive and constructive with your questions and comments.