Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Quadalphanum_HT16K33 demo sketch
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Quadalphanum_HT16K33 demo sketch

by Arduino714 on Wed Aug 26, 2020 8:29 pm

I have successfully loaded the sketch and verified that my quad alphanumeric display and backpack are working. All the segments are functional. When I enter text into the serial monitor, the decimal point becomes a blank space. If I enter, 26.5C, the decimal becomes a space and the digit 2 scrolls off the display. (see attached photo)

I would like to use this display as a temperature readout with 1 decimal place and the units. Is there a special function that will enable this to display properly?

thanks
Attachments
IMG_0919.jpg
IMG_0919.jpg (49.29 KiB) Viewed 31 times

Arduino714
 
Posts: 7
Joined: Mon Jul 27, 2020 9:34 am

Re: Quadalphanum_HT16K33 demo sketch

by adafruit_support_carter on Thu Aug 27, 2020 4:49 pm

You're wanting 26.5C to show up as 265C? There's no special function for that. But it's not too hard to create that behavior. Just multiply the value by 10 and convert to an integer. So 26.5 becomes 265.

adafruit_support_carter
 
Posts: 17179
Joined: Tue Nov 29, 2016 2:45 pm

Re: Quadalphanum_HT16K33 demo sketch

by Arduino714 on Fri Aug 28, 2020 9:28 am

Thanks, but I would like the display to be accurate to 1 decimal place. Is there a way to have the DP led light up all the time in the 2nd digit position so the readings will always be xx.xC.

Arduino714
 
Posts: 7
Joined: Mon Jul 27, 2020 9:34 am

Re: Quadalphanum_HT16K33 demo sketch

by adafruit_support_carter on Mon Aug 31, 2020 12:21 pm

Which library are you using to drive the display?

adafruit_support_carter
 
Posts: 17179
Joined: Tue Nov 29, 2016 2:45 pm

Re: Quadalphanum_HT16K33 demo sketch

by Arduino714 on Tue Sep 01, 2020 4:32 pm

Hello, this is the sketch from the Adafruit LED backpack example library that I am using. When I type an entry in the serial monitor, the decimal point (DP) refuses to light up. Thanks

Code: Select all | TOGGLE FULL SIZE
// Demo the quad alphanumeric display LED backpack kit
// scrolls through every character, then scrolls Serial
// input onto the display

#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"

Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();

void setup() {
  Serial.begin(9600);
 
  alpha4.begin(0x70);  // pass in the address

  alpha4.writeDigitRaw(3, 0x0);
  alpha4.writeDigitRaw(0, 0xFFFF);
  alpha4.writeDisplay();
  delay(200);
  alpha4.writeDigitRaw(0, 0x0);
  alpha4.writeDigitRaw(1, 0xFFFF);
  alpha4.writeDisplay();
  delay(200);
  alpha4.writeDigitRaw(1, 0x0);
  alpha4.writeDigitRaw(2, 0xFFFF);
  alpha4.writeDisplay();
  delay(200);
  alpha4.writeDigitRaw(2, 0x0);
  alpha4.writeDigitRaw(3, 0xFFFF);
  alpha4.writeDisplay();
  delay(200);
 
  alpha4.clear();
  alpha4.writeDisplay();

  // display every character,
  for (uint8_t i='!'; i<='z'; i++) {
    alpha4.writeDigitAscii(0, i);
    alpha4.writeDigitAscii(1, i+1);
    alpha4.writeDigitAscii(2, i+2);
    alpha4.writeDigitAscii(3, i+3);
    alpha4.writeDisplay();
   
    delay(300);
  }
  Serial.println("Start typing to display!");
}


char displaybuffer[4] = {' ', ' ', ' ', ' '};

void loop() {
  while (! Serial.available()) return;
 
  char c = Serial.read();
  if (! isprint(c)) return; // only printable!
 
  // scroll down display
  displaybuffer[0] = displaybuffer[1];
  displaybuffer[1] = displaybuffer[2];
  displaybuffer[2] = displaybuffer[3];
  displaybuffer[3] = c;
 
  // set every digit to the buffer
  alpha4.writeDigitAscii(0, displaybuffer[0]);
  alpha4.writeDigitAscii(1, displaybuffer[1]);
  alpha4.writeDigitAscii(2, displaybuffer[2]);
  alpha4.writeDigitAscii(3, displaybuffer[3]);
 
  // write it out!
  alpha4.writeDisplay();
  delay(200);
}

Arduino714
 
Posts: 7
Joined: Mon Jul 27, 2020 9:34 am

Re: Quadalphanum_HT16K33 demo sketch

by adafruit_support_carter on Tue Sep 01, 2020 4:42 pm

It looks like maybe that feature is missing for that specific matrix display. See issue here:
https://github.com/adafruit/Adafruit_LE ... /issues/42

The 7 segments have some methods for doing this, but (currently) not the alphanumeric display.

adafruit_support_carter
 
Posts: 17179
Joined: Tue Nov 29, 2016 2:45 pm

Re: Quadalphanum_HT16K33 demo sketch

by Arduino714 on Wed Sep 02, 2020 12:07 pm

Hi, thanks for your assistance.

So just to be clear, the alphanumeric display library does not support output of an integer value to the entire 4 digit display. Each digit can only accept a alpha4.write.DigitRaw or alpha4.write.DigitAscii value and each digit need to be addressed individually.

If that is the case, I would need to use a logic statement to match the measured value to output as a Ascii value to each digit. Using an integer named Temp.

Code: Select all | TOGGLE FULL SIZE
if (Temp == 26);
 
  alpha4.writeDigitAscii(0, '2');
  alpha4.writeDigitAscii(1, '6');
  alpha4.writeDigitAscii(2, '`');
  alpha4.writeDigitAscii(3, 'c');

  alpha4.writeDisplay();


This appears to work but requires more coding. Is there a better solution?

I'm half way there! Thanks again

Arduino714
 
Posts: 7
Joined: Mon Jul 27, 2020 9:34 am

Re: Quadalphanum_HT16K33 demo sketch

by adafruit_support_carter on Wed Sep 02, 2020 12:25 pm

You could use the lower level write from the base class:
https://github.com/adafruit/Adafruit_LE ... pack.h#L90
but that would require more understanding of how the display works.

The better way would be for the Adafruit_AlphaNum4 class to implement all the various methods that the Adafruit_7segment class does. That's what that issue linked above is requesting.

adafruit_support_carter
 
Posts: 17179
Joined: Tue Nov 29, 2016 2:45 pm

Re: Quadalphanum_HT16K33 demo sketch

by Arduino714 on Wed Sep 02, 2020 6:01 pm

Do I cut and paste the library code from the Segment7 and insert into the alpha4 section? The use of the lower level write is probably over my head for now......maybe later.

For now I have managed to output my temperature readings as an integer using the Switch (case) Statement. Crude but is functional for my purposes.

Code: Select all | TOGGLE FULL SIZE
// read the Temp:
  // map the sensor range to a range of 13 temperature readings:
  int range = map(steinhart, TempMin, TempMax, 0, 12);

  // do something different depending on the range value:
  switch (range) {
    case 0:    // lowest range of Temp reading @16*C
      Serial.println(steinhart);
      alpha4.writeDigitAscii(0, '1');
      alpha4.writeDigitAscii(1, '6');
      alpha4.writeDigitAscii(2, '`');
      alpha4.writeDigitAscii(3, 'c');
 
      alpha4.writeDisplay();
      break;
    case 1:    //Temp@17*C
      Serial.println(steinhart);
      alpha4.writeDigitAscii(0, '1');
      alpha4.writeDigitAscii(1, '7');
      alpha4.writeDigitAscii(2, '`');
      alpha4.writeDigitAscii(3, 'c');


Thanks for your help!

Arduino714
 
Posts: 7
Joined: Mon Jul 27, 2020 9:34 am

Re: Quadalphanum_HT16K33 demo sketch

by adafruit_support_carter on Wed Sep 02, 2020 7:19 pm

It's likely the code can't just be copy/pasted. It would need to be adapted for the alphanumeric display.

adafruit_support_carter
 
Posts: 17179
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.