I would like to figure out a code to print 4 letter words or 3 or 4 digit with decimal numbers (like from a sensor) on my display, I really love these displays except the fact that the coding learning curve is somewhat difficult compared to an OLED or something, I have tried the search function and I have seen a few but not an entire example code for this specific purpose which I would like to use more of these if I can get it figured out.

So here is where im testing this, i grabbed one of these one wire sensors to test with , i plan on using this with o2 sensors and map sensors by changing the current function with a rotary encoder or buttons . so what im really after is chopping any number down to 4 digits, printing the decimal (i couldnt figure out the 16bit numbering to save my life), and displaying numbers or letters like LEAN, RICH, 14.1p or 101k or any other combination of numbers and letters 4 at a time. so if there is an easy way to send the currently selected value to a function that can chop it down to 4 digits, place a decimal and move on that would be great.

im trying to figure out a void function i can put in to just display the data no matter what I throw at it w/o scrolling etc.

can someone please help me make this easy, maybe there is a print function i dont know about. but i feel this would help so many other folks as I have read these questions numerous times on the internet

nitrousbob

Posts: 8
Joined: Sun Mar 11, 2018 1:43 pm

Re: Quad Alphanumeric display 14segment help

so ive noticed in circuit python we have display.text, and possibly an older backpack that used to use matrix.print

nitrousbob

Posts: 8
Joined: Sun Mar 11, 2018 1:43 pm

Re: Quad Alphanumeric display 14segment help

im not opposed to learning how to program this, i just dont know where to look, i have a couple of C++ books if I knew the statements im trying to make.

nitrousbob

Posts: 8
Joined: Sun Mar 11, 2018 1:43 pm

Re: Quad Alphanumeric display 14segment help

Here is a giant mess, it works for numbers above 0 and under 1000 im guessing. Now i can send decimal numbers with 1 place after to my LED backpack 14segment display.

Code: Select all | TOGGLE FULL SIZE
`#include <Wire.h>#include "Adafruit_LEDBackpack.h"#include "Adafruit_GFX.h"#include <OneWire.h>#include <DallasTemperature.h>Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();#define ONE_WIRE_BUS 8OneWire oneWire(ONE_WIRE_BUS);DallasTemperature sensors(&oneWire);int numPrePrint = 0;int numToPrint = 0;double temp;    //declare temp variablechar displaybuffer[4] = {' ', ' ', ' ', ' '};void setup(){  Serial.begin(9600);  sensors.begin();  alpha4.begin(0x70);}void loop(){ tempOne(); }void tempOne(){  sensors.requestTemperatures(); //request temperature  temp = sensors.getTempCByIndex(0) * 1.8 + 32; //convert to F  numPrePrint=temp;  displayNumbers();}void displayNumbers(){  if (numPrePrint >= 100) {  numberabove100(); }  else if (numPrePrint < 100)  {    numberbelow100();  }  else{    }alpha4.writeDisplay();  delay(200);}void numberbelow100(){  numToPrint = numPrePrint * 100;  dtostrf(numToPrint, 3, 1, displaybuffer); //convert double to char array  alpha4.writeDigitRaw(0, 0x0);  alpha4.writeDigitAscii(1, displaybuffer[0]); //display char 2  alpha4.writeDigitAscii(2, displaybuffer[1], 1); //display char 3  alpha4.writeDigitAscii(3, displaybuffer[2]); //display char 4}void numberabove100(){  numToPrint = numPrePrint * 100;  dtostrf(numToPrint, 3, 1, displaybuffer); //convert double to char array  alpha4.writeDigitAscii(0, displaybuffer[0]); //display char 1  alpha4.writeDigitAscii(1, displaybuffer[1]); //display char 2  alpha4.writeDigitAscii(2, displaybuffer[2], 1); //display char 3  alpha4.writeDigitAscii(3, displaybuffer[3]); //display char 4}`

nitrousbob

Posts: 8
Joined: Sun Mar 11, 2018 1:43 pm