Weird characters on my LCD ive never seen

Hi, I’m fairly new to the Arduino community. I wanted to create an RFID scanner that when scanned prints welcome. But when I hold the card up to it, it prints 32 then a bunch of weird character. Any thoughts on what it is? Thanks!

rfid_lcd.ino (2.66 KB)


How to post an image so we don't have to download it.

LiquidCrystal lcd(1, 2, 4, 5, 6, 7);

What Arduino board are you using? Pin 1 on most Arduino boards is the hardware serial (Serial) TX pin.

lcd.begin(16,1);

Do you really have a 1 line LCD display? Looks like a 2 line from here.

lcd.setCursor(1,2);

That will set the cursor to the 3rd line of the display (lines are numbered starting at 0).

You will get faster help if you post your code in accordance with the forum guidelines. Read the how to use this forum-please read sticky to see how to, properly, post code and some advice on how to ask a good question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

Post code in code tags like so:

#include <SPI.h>
#include <RFID.h>
#include <LiquidCrystal.h>

#define SS_PIN 10
#define RST_PIN 9

RFID rfid(SS_PIN, RST_PIN);

LiquidCrystal lcd(1, 2, 4, 5, 6, 7);

//int power = 7;
int led = 8;
int serNum[5];
/*
   This integer should be the code of Your Mifare card / tag
*/
int cards[][5] = {{                              200, 182, 216, 185, 31}};

bool access = false;

void setup()
{
   Serial.begin(9600);
   SPI.begin();
   rfid.init();
   lcd.begin(16, 1);
   /*
      define VMA100 (UNO) pins 7 & 8 as outputs and put them LOW
   */
   pinMode(led, OUTPUT);
   //pinMode (power,OUTPUT);
   digitalWrite(led, LOW);
   //digitalWrite (power,LOW);
   lcd.clear();
   lcd.setCursor(1, 2);
}

void loop()
{
   if (rfid.isCard())
   {
      if (rfid.readCardSerial())
      {
         Serial.print(rfid.serNum[0]);
         Serial.print(" ");
         Serial.print(rfid.serNum[1]);
         Serial.print(" ");
         Serial.print(rfid.serNum[2]);
         Serial.print(" ");
         Serial.print(rfid.serNum[3]);
         Serial.print(" ");
         Serial.print(rfid.serNum[4]);
         Serial.println("");

         for (int x = 0; x < sizeof(cards); x++)
         {
            for (int i = 0; i < sizeof(rfid.serNum); i++ )
            {
               if (rfid.serNum[i] != cards[x][i])
               {
                  access = false;
                  break;
               }
               else
               {
                  access = true;
               }
            }
            if (access) break;
         }
      }

      if (access)
      {
         Serial.println("Welcome Velleman ");
         lcd.print("Hello Mike");

         /*
            Valid card : Switch ON the LED for 1000 ms (1 second)
         */
         digitalWrite(led, HIGH);
         delay(1000);
         /*
            Valid card : Switch ON the POWER PIN for 2000 ms (2 seconds)), the POWER PIN can activate for example a relais, controlling a doorlock)
         */
         //digitalWrite(power, HIGH);
         delay(2000);
         //digitalWrite(power, LOW);
         digitalWrite(led, LOW);
         access = false;

      }
      else
      {
         /*
            NON-Valid card : switch ON and OFF the LED twice for 0,5 seconds
         */
         lcd.clear();
         lcd.print("Not Mike");
         Serial.println("Not allowed!");
         digitalWrite(led, HIGH);
         delay(500);
         digitalWrite(led, LOW);
         delay(500);
         digitalWrite(led, HIGH);
         delay(500);
         digitalWrite(led, LOW);
      }
   }
   rfid.halt();
}

Thanks for all the tips, I had read how to use this page thing and got lost. Besides that, I use an Arduino Uno. And yes I realized that using lcd.begin(16, 1); did that I was just experimenting I changed it to (16, 2) and still does the same thing.

So did you also do something with his first comment?

groundFungus:
What Arduino board are you using? Pin 1 on most Arduino boards is the hardware serial (Serial) TX pin.

I looked at it just what pin would you suggest I use instead?

So I got it to work. But when it prints it prints my message with weird characters after it.

When you make changes to your code, post the newest version so that we can keep up. And a photo of the display, too.

mrgagne:
I looked at it just what pin would you suggest I use instead?

Any pin that’s not already used by something else…

The analog inputs are also usable as digital input/output if you are out of regular digital pins.

I suggest that you get the display working by itself and add the RFID part once the display is working.

Thanks for all your help guys, I really appreciate it. I now also understand the proper way to use this forum also!