I just received my Netduino Plus today and I have already started working on my project.
For this project I am using the Parallax RFID Read/Write Module, Serial (#28440) (http://www.parallax....dWrite-v1.0.pdf) and a Serial LCD module I got from SparkFun.
I already managed to get the LCD display working but I can't seem to get the RFID to read the tags.
I am currently using the following code:
static SerialLCD lcd = new SerialLCD(); static SerialPort rfid = new SerialPort(SerialPorts.COM2, 9600, Parity.None, 8, StopBits.One); public static void Main() { lcd.ClearDisplay(); rfid.DataReceived += new SerialDataReceivedEventHandler(rfid_DataReceived); while (true) { byte[] command = new byte[] { (byte)'!', (byte)'R', (byte)'W', 0x01, 0x32 }; rfid.Write(command, 0, command.Length); Thread.Sleep(5000); } } static void rfid_DataReceived(object sender, SerialDataReceivedEventArgs e) { byte[] msg = new byte[5]; ((SerialPort)sender).Read(msg, 0, msg.Length); if (msg[0] == 0x01) { lcd.ClearDisplay(); lcd.Write(msg[1]); lcd.Write(msg[2]); lcd.Write(msg[3]); lcd.Write(msg[4]); } else if (msg[0] == 0x02) { lcd.ClearDisplay(); lcd.Write("Did not find a listen window"); } else if (msg[0] == 0x03) { lcd.ClearDisplay(); lcd.Write("Could be invalid command"); } else if (msg[0] == 0x04) { lcd.ClearDisplay(); lcd.Write("Sending old password"); } else if (msg[0] == 0x05) { lcd.ClearDisplay(); lcd.Write("Sending new password"); } else if (msg[0] == 0x06) { lcd.ClearDisplay(); lcd.Write("No Listen Window after new passw"); } else if (msg[0] == 0x07) { lcd.ClearDisplay(); lcd.Write("Parity error reading data"); } }
I never seem to get a returning message that starts with the 0x01 byte...
Could anyone see whether I am making some big or small mistake here?