Hi folks;
I am trying I am trying to send Mfrc522 data to a c# application through Nodemcu esp8266 which is acting as access point for c# app.
I have modified the code which i got from the following site:-
http://tdmts.net/2017/02/04/controlling-an-arduino-with-a-wifi-esp8266-adapter-using-a-windows-10-universal-app/
and my modified code is :=
#include ESP8266WiFi.h>
#include SPI.h>
#include MFRC522.h>
const char* AP_SSID ="IoT4143" ;
const char* AP_PASSWORD ="iot4143";
#define RST_PIN D3
#define SS_PIN D4
MFRC522 mfrc522(SS_PIN, RST_PIN);
WiFiServer server(80);
WiFiClient client;
void wifiConnect()
{
WiFi.disconnect();
WiFi.softAP(AP_SSID, AP_PASSWORD);
int watchDog = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(500);
watchDog++;
if(watchDog == 60)
{
WiFi.disconnect();
WiFi.printDiag(Serial);
watchDog = 0;
return;
}
}
server.begin();
}
void setup() {
Serial.begin(115200);
SPI.begin();
mfrc522.PCD_Init();
mfrc522.PCD_DumpVersionToSerial();
Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
wifiConnect();
}
void loop() {
if(WiFi.status() != WL_CONNECTED)
{
wifiConnect();
}
client = server.available();
if (!client) {
return;
}
int watchDog = 0;
while(!client.available())
{
delay(1);
if(watchDog == 10000)
{
watchDog = 0;
return;
}
watchDog++;
}
sendData();
}
void sendData()
{
String request = client.readStringUntil('\r');
client.flush();
while(request=="READSTOP")
{
Serial.println("RFID READING STARTED...");
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
client.print(mfrc522.uid);
}
Serial.println("RFID READING STOPPED");
delay(1);
client.stop();
}
I am very new to hardware/network programming i dont know what will be possible errors of above code and will it work or not
when i verified the above code in arduino ide the wasa error on this line of code:=
client.print(mfrc522.uid);
error:= no matching function for call to 'WiFiClient::print(MFRC522::Uid&)'
I just want to send rfid data to c# app all the validation will be done in c#.
When the connect button in application is clicked the "READSTART" string is send to nodemcu and when disconnect is clicked the "READSTOP" string is sent.
Please need help!!!!
What I have tried:
I have not uploaded the code on my hardware becoz of doubt in my code.