0
votes

I'm working a project using Arduino Mega 2560, LCD Keypad Shield, and RFID 13,56 MHz MF522 module.

The problem is that the LCD Keypad shield and RFID MF522 are using pin 5 together, so I changed RFID pin to the other digital pin (I'm using pin 31 now). But when I initialize the RFID and LCD shield, the LCD is not working. When I don't initialize the RFID, the LCD shield working well.

I'm using the LiquidCrystal library for the LCD, and RFID library made by Miguel Balboa (circuitito.com) based on code by Dr.Leong (www.b2cqshop.com).

Here's some simple code I've made :

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
RFID rfid(53,31); //when init RFID, pin 5 changed to 31

void setup()
{

 Serial.begin(9600);
 analogWrite(10, 50); // set brightness on pin 10 to 0-255
 lcd.begin(16, 2);              // start the library
 rfid.init();  //when RFID init, LCD not working
}


void loop()
{
    lcd.setCursor(9,1);            // move cursor to second line "1" and 9 spaces over
    lcd.print(millis()/1000);      // display seconds elapsed since power-up

}

Any suggestion to make the LCD shield work together with the RFID module? Or am I doing something wrong?

Note : I've tried using just the RFID using pin 31 without init the LCD, and the RFID is working well.

1
what pin you are using for your LED? +ve? and Gnd ?Abraham K
LCD using pin (8, 9, 4, 5, 6, 7), you can see the LCD pin here dfrobot.com/wiki/…daniel nova
Ohh, I've got the answer by myself.. I'm just forget to add the SPI. At the setup, just add SPI.begin() and now my LCD and RFID can work together.daniel nova
@danielnova Feel free to add that as an actual answer and accept it. Then that information will be easily available for other with the same problem. Perhaps add some details/an explanation if you can.Bart
Ok, I'll add my answer Bart, thanks :Ddaniel nova

1 Answers

0
votes

Ohh, I've got the answer by myself.. I'm just forget to add the SPI. At the setup, just add SPI.begin() and now my LCD and RFID can work together.

Here's the setup :

void setup()
{
     Serial.begin(9600);
     SPI.begin();
     rfid.init();
     analogWrite(10, 50); // set brightness on pin 10 to 0-255
     lcd.begin(16, 2);              // start the library
}