system
April 20, 2013, 11:09am
1
Hi, I kinda need your help here. I'm using Arduino Uno + NFC Shield by seeedstudio + 16x2 LCD
I'm trying to get display out but it only display until the "Hello!". THe Serial Monitor do detect the appearance of the NFC card but no display is out. Can you guys see what's the problem with my programming?
#include <PN532.h>
#include <SPI.h>
#include <LiquidCrystal.h>
#define PN532_CS 10
PN532 nfc(PN532_CS);
//#define NFC_DEMO_DEBUG 1
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(void) {
//#ifdef NFC_DEMO_DEBUG
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Hello!");
delay(5000);
lcd.noDisplay();
//#endif
nfc.begin();
}
void loop(void) {
uint32_t id;
// look for MiFare type cards
id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);
if (id != 0) {
//#ifdef NFC_DEMO_DEBUG
lcd.display();
lcd.print("lolwut");
delay(5000);
//#endif
}
}
system
April 20, 2013, 11:45am
2
Can you guys see what's the problem with my programming?
Instead of commenting out the conditional stuff, you should have deleted it.
You have Serial.begin() in setup(). You do not have Serial.print() statements in loop(). You should.
You expect nfc.readPassiveTargetID() to return a non-zero value. You expect no output if it doesn't. My guess, then, would be that it doesn't.
What pins does the NFC shield use? Is it an SPI device, by any chance? If so, it uses pins 11, 12, and 13 (some of which your LCD also uses).
system
April 20, 2013, 11:59am
3
PaulS:
Can you guys see what's the problem with my programming?
Instead of commenting out the conditional stuff, you should have deleted it.
You have Serial.begin() in setup(). You do not have Serial.print() statements in loop(). You should.
You expect nfc.readPassiveTargetID() to return a non-zero value. You expect no output if it doesn't. My guess, then, would be that it doesn't.
What pins does the NFC shield use? Is it an SPI device, by any chance? If so, it uses pins 11, 12, and 13 (some of which your LCD also uses).
I guess you're right about the pins. Meaning I can't use the LCD. Thanks a lot!