Item selection from list using push button

4 digit, 14 segment alphanumeric displays based on the HT16K33 driver are available. It certainly makes text easier to represent.

1 Like

Thank You Sir, will try

Sir,
Toady I got Alphanumeric Display which display All character,if possible help me to show character on display instead of 1,2,3.... or

Sure. You have exactly what you pictured? How do you want to drive the module? I have boards with 4 of those, driven by an HT16K33 IC. Looks like this:

There is no functional difference between that display and a 7 segment. The only difference is the number of segments.

I hope when you bought it, you found schematics or pinouts first.

Sir,

Code provided by Mr. gcjr is perfect.Only issue is when we push the button to Select TC, it displays number 1,2,3 & so on ....Number 3 =K its very clear from code.In long term difficult to remember the number.It would be better to Display J,K,B,R,S,T instead of their number on First Alphanumeric Display.Kindly help to change in code.

Show us your attempt to change it. We can help you with any issues with your attempt.

I did some coding with lcd & tested .....It works but when I tried to made changes in code or tried to merge codes.Dint work.

Individually my code works....which is as follows.As I wrote I am not best coader.

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 20, 4);


//  maxthermo.begin();

enum PlantType{      
  TYPE_B,        // MAX31856_TCTYPE_B: =  TYPE_B                               
  TYPE_E,        // MAX31856_TCTYPE_E: =  TYPE_E                                   
  TYPE_J,        // MAX31856_TCTYPE_J: =  TYPE_J                                   
  TYPE_K,        // MAX31856_TCTYPE_K: =  TYPE_K
  TYPE_N,        // MAX31856_TCTYPE_N: =  TYPE_N
  TYPE_R,        // MAX31856_TCTYPE_R: =  TYPE_R
  TYPE_S,        // MAX31856_TCTYPE_S: =  TYPE_S
  TYPE_T,        // MAX31856_TCTYPE_T: =  TYPE_T
  END_OF_LIST
};
PlantType plantType = TYPE_B;

char* plantString[] = {"TYPE_B", "TYPE_E", "TYPE_J", "TYPE_K" , "TYPE_N" , "TYPE_R" , "TYPE_S" , "TYPE_T" , "None"};

const byte buttonPin = 7;

void setup() 
{
  pinMode(buttonPin,INPUT_PULLUP);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Select Your TC!!");
  // delay(2000);
  // lcd.clear();
  
}

void loop() 
{
  if(checkForPress())
  {
    plantType = PlantType(int(plantType)+1);
    if(plantType == END_OF_LIST) plantType = TYPE_B;  //<<< Edited here
    // lcd.setCursor(0, 0);
    // lcd.print(F("Type Of TC: "));
    lcd.setCursor(0, 1);
    lcd.print(plantString[plantType]);
    //delay(2000);
    //lcd.clear();
  }
  delay(30);  //crude de-bounce
}

int checkForPress()
{
  static byte lastState = HIGH;
  byte state = digitalRead(buttonPin);
  if (state != lastState){
    lastState = state;
    if(state == LOW)
    {
      return 1;
    }
  }
  return 0;
}

This code display Just Character....Like J,K,B,R,S etc

what doesn't work?

are you trying to display an alphanumeric on the new display you got?

Sir,
In your code I tried to change like follows:

enum PlantType{
TYPE_B, // MAX31856_TCTYPE_B: = TYPE_B
TYPE_E, // MAX31856_TCTYPE_E: = TYPE_E
TYPE_J, // MAX31856_TCTYPE_J: = TYPE_J
TYPE_K, // MAX31856_TCTYPE_K: = TYPE_K
TYPE_N, // MAX31856_TCTYPE_N: = TYPE_N
TYPE_R, // MAX31856_TCTYPE_R: = TYPE_R
TYPE_S, // MAX31856_TCTYPE_S: = TYPE_S
TYPE_T, // MAX31856_TCTYPE_T: = TYPE_T
END_OF_LIST
};

So that I can display Character.But couldnt succeed.

Yes Sir, First One display is Alphanumeric type and rest of 3 is ordinary display

i don't see any code to display an alphanumeric value on an alphanumeric display.

i don't know if the display can be given an alphanumeric value such as 'A" and knows which segments to light or if you need to have code to determine which segments to light.

a 7-segment display has at least 7 inputs, one for each segment and a common. it isn't given a value, such as 6 and know which segments to light

I tested on LCD Liquid crystal.
If it display on serial monitor doesnt matter,that display on Segment part I will manage.

consider
i think you just want a list of letters

# include <LiquidCrystal_I2C.h>
const byte buttonPin = 7;

LiquidCrystal_I2C lcd (0x27, 20, 4);

const char *types [] = {"B", "E", "J", "K" , "N" , "R" , "S" , "T" };
const unsigned Ntype = sizeof(types) / sizeof(char*);

unsigned  typeIdx;

// -----------------------------------------------------------------------------
void setup ()
{
    pinMode (buttonPin,INPUT_PULLUP);
    lcd.init ();
    lcd.backlight ();
    lcd.print ("Select Your TC!!");
    // delay (2000);
    // lcd.clear ();
}

void loop ()
{
    if (checkForPress())
    {
        if (Ntype <= ++typeIdx)
            typeIdx = 0;
        // lcd.setCursor (0, 0);
        // lcd.print (F("Type Of TC: "));
        lcd.setCursor (0, 1);
        lcd.print (types [typeIdx]);
        //delay (2000);
        //lcd.clear ();
    }
}

int checkForPress ()
{
    static byte lastState = HIGH;
    byte state = digitalRead (buttonPin);
    if (state != lastState){
        lastState = state;
        delay (30);         //de-bounce
        if (state == LOW)
            return 1;
    }
    return 0;
}

Exactly Sir

Exactly

actually, I think you want a list of chars

char types [] = {'B', 'E', 'J', 'K' , 'N' , 'R' , 'S' , 'T' };

for instance When button is pressed ,it should display only Character like if I want to select THermocouple type K.....I will push the button untill it display K....means K Type is selected .
If I want to use Thermocouple type B then I push the button till B appears on display

Here are alpha fonts for 7 segments:

// Definition for the displayable ASCII chars
// (note that non-alpha-numeric characters may display as a space or a simple dash)
const PROGMEM byte TM16XX_FONT_DEFAULT[] = {
  0b00000000, // (32)  <space>
  0b10000110, // (33)	!
  0b00100010, // (34)	"
  0b01111110, // (35)	#
  0b01101101, // (36)	$
  0b00000000, // (37)	%
  0b00000000, // (38)	&
  0b00000010, // (39)	'
  0b00110000, // (40)	(
  0b00000110, // (41)	)
  0b01100011, // (42)	*
  0b00000000, // (43)	+
  0b00000100, // (44)	,
  0b01000000, // (45)	-
  0b10000000, // (46)	.
  0b01010010, // (47)	/
  0b00111111, // (48)	0
  0b00000110, // (49)	1
  0b01011011, // (50)	2
  0b01001111, // (51)	3
  0b01100110, // (52)	4
  0b01101101, // (53)	5
  0b01111101, // (54)	6
  0b00100111, // (55)	7
  0b01111111, // (56)	8
  0b01101111, // (57)	9
  0b00000000, // (58)	:
  0b00000000, // (59)	;
  0b00000000, // (60)	<
  0b01001000, // (61)	=
  0b00000000, // (62)	>
  0b01010011, // (63)	?
  0b01011111, // (64)	@
  0b01110111, // (65)	A
  0b01111111, // (66)	B
  0b00111001, // (67)	C
  0b00111111, // (68)	D
  0b01111001, // (69)	E
  0b01110001, // (70)	F
  0b00111101, // (71)	G
  0b01110110, // (72)	H
  0b00000110, // (73)	I
  0b00011110, // (74)	J
  0b01101001, // (75)	K
  0b00111000, // (76)	L
  0b00010101, // (77)	M
  0b00110111, // (78)	N
  0b00111111, // (79)	O
  0b01110011, // (80)	P
  0b01100111, // (81)	Q
  0b00110001, // (82)	R
  0b01101101, // (83)	S
  0b01111000, // (84)	T
  0b00111110, // (85)	U
  0b00101010, // (86)	V
  0b00011101, // (87)	W
  0b01110110, // (88)	X
  0b01101110, // (89)	Y
  0b01011011, // (90)	Z
  0b00111001, // (91)	[
  0b01100100, // (92)	\ (this can't be the last char on a line, even in comment or it'll concat)
  0b00001111, // (93)	]
  0b00000000, // (94)	^
  0b00001000, // (95)	_
  0b00100000, // (96)	`
  0b01011111, // (97)	a
  0b01111100, // (98)	b
  0b01011000, // (99)	c
  0b01011110, // (100)	d
  0b01111011, // (101)	e
  0b00110001, // (102)	f
  0b01101111, // (103)	g
  0b01110100, // (104)	h
  0b00000100, // (105)	i
  0b00001110, // (106)	j
  0b01110101, // (107)	k
  0b00110000, // (108)	l
  0b01010101, // (109)	m
  0b01010100, // (110)	n
  0b01011100, // (111)	o
  0b01110011, // (112)	p
  0b01100111, // (113)	q
  0b01010000, // (114)	r
  0b01101101, // (115)	s
  0b01111000, // (116)	t
  0b00011100, // (117)	u
  0b00101010, // (118)	v
  0b00011101, // (119)	w
  0b01110110, // (120)	x
  0b01101110, // (121)	y
  0b01000111, // (122)	z
  0b01000110, // (123)	{
  0b00000110, // (124)	|
  0b01110000, // (125)	}
  0b00000001, // (126)	~
};

I already have
const byte NUMBERS[] = {
//ABCDEFG
B11111100, // 0
B01100000, // 1
B11011010, // 2
B11110010, // 3
B01100110, // 4
B10110110, // 5
B10111110, // 6
B11100000, // 7
B11111110, // 8
B11100110 // 9
};

const byte LETTERS[] = {
//ABCDEFG
B11101110, // a
B00111110, // b
B10011100, // c
B01111010, // d
B10011110, // e
B10001110, // f
B10111100, // g
B01101110, // h
B00001100, // i
B01111000, // j
B10101110, // k
B00011100, // l
B11101100, // m
B00101010, // n
B00111010, // o
B11001110, // p
B11100110, // q
B10001100, // r
B10110110, // s
B00011110, // t
B00111000, // u
B01111100, // v
B01111110, // w
B01101100, // x
B01110110, // y
B11011010 // z

7 Segment code is not a problem , Only would like to display char = {'B', 'E', 'J', 'K' , 'N' , 'R' , 'S' , 'T' };
with Mr. gcjr code.