Show HEX data on an LCD display

:confused:

Hi,
I have an RFID reader (PN5180) and LCD (16x2) connected. I can print tag (iso 15693) on serial monitor like the UID. Result on screen: E0 04 01 50 D4 7E A0 CC. However I want to capture this data so I can use comparing it and displaying it on the LCD. The error I get on line: lcd1.print(uid[7 - i], HEX); is:
no matching function for call to 'LCDIC2::print(uint8_t&, int)'. Something to do with the HEX. Please advice. Thank you!!!!

#include "LCDIC2.h"
#include <Wire.h>
#include <PN5180.h>
#include <PN5180ISO15693.h>

#define PN5180_NSS 10
#define PN5180_BUSY 9
#define PN5180_RST 8

LCDIC2 lcd1(0x27, 16, 2);
PN5180ISO15693 nfc(PN5180_NSS, PN5180_BUSY, PN5180_RST);

void setup() {
Serial.begin(9600);
nfc.begin();

lcd1.begin(); // Init with pin 0-SLA and 1-SDA
lcd1.setBacklight(HIGH); // turn on
lcd1.setCursor(0, 0);
lcd1.print("Start test");
}

void loop() {
nfc.reset();
nfc.setupRF();
uint8_t uid[8];
byte a = 0;

ISO15693ErrorCode rc = nfc.getInventory(uid);// Try to read a tag ID
if (rc == ISO15693_EC_OK) { // If the result code was that a card had been read
lcd1.home();
lcd1.print(F("UID = "));

if (rc >= 0) {
Serial.print(F("UID = "));
for (byte i = 0; i < 8; i++) {
Serial.print(uid[7 - i], HEX); // LSB is first
Serial.print(" ");
a = (uid*);*

  • lcd1.setCursor(i, 1);*
  • lcd1.print(uid[7 - i], HEX);*
  • }*
  • Serial.println();*
  • }*
  • }*
  • delay(700);*
    }

(post deleted by author)

Sorry you are right! Thought my explanation was not clear and therefor re-wrote it. Will use the Code feature next time!
Would appreciate if you can give me a code suggestion to covert hex to dec (which part in my code should change)?
Thanks again!

trying using sprintf() to format a string the way you want and displaying the resulting string on the LCD

char s [20];
sprintf (s, " %02x", val);
lcd1.print (s);

(post deleted by author)

If this is the library you're using: GitHub - offcircuit/LCDIC2, it appears the author chose not to inherit the LCDIC2 class from the Print class. They did their users a disservice.

Thank you all, issue resolved with suggestion from GCJR. Super happy! :slight_smile: