RFID data to plx-daq excel

hello guys… im try to edit code to make it generate into axcel directly…the problem here im able to read DATE,TIME,RFID…im need to add my other int data for testing…

this is the code:

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

int readsuccess;
byte readcard[4];
char str[32] = “”;
String StrUID;
int joker =13;

void setup() {
// Serial.println(“CLEARDATA”);
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
MFRC522::StatusCode status;

// Serial.println(“CLEARDATA”);
Serial.println(“LABEL,Date,Time,RFID,JENIS IKAN”);
delay(1000);
}
// --------------------------------------------------------------------
void loop() {
//
byte block, len;

//
readsuccess = getid();

if(readsuccess){
Serial.println( (String) “DATA,DATE,TIME,” +StrUID); //This data im able to generate to excel
Serial.println((String) “IKAN” +joker); //here the problem

}
}
// --------------------------------------------------------------------
int getid(){
if(!mfrc522.PICC_IsNewCardPresent()){
return 0;
}
if(!mfrc522.PICC_ReadCardSerial()){
return 0;
}

for(int i=0;i<4;i++){
readcard_=mfrc522.uid.uidByte*; //storing the UID of the tag in readcard*_
* array_to_string(readcard, 4, str);
_
StrUID = str;_
_
}*_

MFRC522::MIFARE_Key key;
* mfrc522.PICC_HaltA();
_
return 1;*_

}
// --------------------------------------------------------------------
void array_to_string(byte array[], unsigned int len, char buffer[])
{
* for (unsigned int i = 0; i < len; i++)*
* {*
_ byte nib1 = (array >> 4) & 0x0F;
byte nib2 = (array >> 0) & 0x0F;
buffer[i*2+0] = nib1 < 0xA ? ‘0’ + nib1 : ‘A’ + nib1 - 0xA;
buffer[i*2+1] = nib2 < 0xA ? ‘0’ + nib2 : ‘A’ + nib2 - 0xA;
* }
buffer[len2] = ‘\0’;

}
[/quote]
Only_Read_UID.ino (1.77 KB)

_

You start by reading the sticky post at the beginning of the forum about how to post your code using code tags. It helps people help you.

Then, you attempt to merge the two program together however you want them to work.

If you get stuck, you post your code, along with a good explanation of what it is doing vs. what you want it to be doing and people can help.

hello sir... im have the problem that im need to insert data that im highlight before....only data that name "IKAN" unable to put inside excel directly...idk why...because of the Serial.println( (String) "DATA,DATE,TIME," +StrUID ); "....why cant im add more like this Serial.println( (String) "DATA,DATE,TIME," +StrUID +joker);....do you have any solution for this...

Each set of data should start with the string “DATA” and end with so you should only use Serial.println at the end of the data

example:

if(readsuccess){
    Serial.print( (String) "DATA,DATE,TIME," +StrUID); //This data im able to generate to excel
    Serial.println((String) "IKAN" +joker); //here the problem

  }

also each data item should be separated by a comma

Please edit your post to add code tags, after reading the "How to use this forum" guidelines.

On the standard Arduino, Strings cause memory problems and program crashes. Avoid using them.