Arduino Excell how to stop rewtiring cells via plx-daq reconnection

I have an attendance system based on arduino uno sending data to excell via plx-daq. The problem is occured while reconnecting plx-daq, new data rewrites to already filled cells. How to make data write to empty cells when pxl-daq is reconnected (or pc restart)?


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

#define SS_PIN 10 //RX slave select
#define RST_PIN 9

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

byte card_ID[4]; //card UID size 4byte
byte Name1[4]={0x64,0x06,0xAE,0xEB};//first UID card
byte Name2[4]={0xC6,0x90,0x63,0xAF};//second UID card
byte Name3[4]={0x6E,0x75,0x62,0xC9};//second UID card
byte Name4[4]={0xE5,0x1C,0xFF,0x00};//second UID card

//if you want the arduino to detect the cards only once
//int NumbCard[4];//this array content the number of cards. in my case i have just two cards.
int j=0;        

int const RedLed=6;
int const GreenLed=5;
int const Buzzer=8;

String Name;//user name
long Number;//user number
int n ;//The number of card you want to detect (optional)  

void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  SPI.begin();  // Init SPI bus
  mfrc522.PCD_Init(); // Init MFRC522 card
  //Serial.println("CLEARSHEET");                 // clears starting at row 1
  //Serial.println("LABEL,Date,Time,Name,Number");// make four columns (Date,Time,[Name:"user name"]line 48 & 52,[Number:"user number"]line 49 & 53)


void loop() {
  //look for new card
   if ( ! mfrc522.PICC_IsNewCardPresent()) {
  return;//got to start of loop if there is no card present
 // Select one of the cards
 if ( ! mfrc522.PICC_ReadCardSerial()) {
  return;//if read card serial(0) returns 1, the uid struct contians the ID of the read card.
 for (byte i = 0; i < mfrc522.uid.size; i++) {

       Name="Denis";//user name
       Number=1;//user number
       j=0;//first number in the NumbCard array : NumbCard[j]
      else if(card_ID[i]==Name2[i]){
       Name="Dima";//user name
       Number=2;//user number
       j=1;//Second number in the NumbCard array : NumbCard[j]
      else if(card_ID[i]==Name3[i]){
       Name="Islam";//user name
       Number=61;//user number
       j=2;//Second number in the NumbCard array : NumbCard[j]
      else if(card_ID[i]==Name4[i]){
       Name="Alla";//user name
       Number=4;//user number
       j=3;//Second number in the NumbCard array : NumbCard[j]
          goto cont;//go directly to line 85
      //if(NumbCard[j] == 1){//to check if the card already detect
      //if you want to use LCD
      //Serial.println("Already Exist");
      //NumbCard[j] = 1;//put 1 in the NumbCard array : NumbCard[j]={1,1} to let the arduino know if the card was detecting 
      Serial.print("DATA,DATE,TIME," + Name);//send the Name to excel
      Serial.println(Number); //send the Number to excel

//if you want to close the Excel when all card had detected and save Excel file in Names Folder. in my case i have just 2 card (optional)
  //  Serial.println("FORCEEXCELQUIT");
 //   }

PLX-DAQ v 2.11 has the option to select which row to write data to. The value of the row is written to Excel as a string, for example


Thank you! So I need to write a function that gonna look for first empty row after connecting the plx isn’t it?

Possibly the easiest way to do that would be to store the current ROW number in a spare CELL and retrieve the value each time you restart. This is the comment from PLX-DAQ VBA code for reading a cell

'## NOTE syntax to be Serial.println("CELL,GET,FROMSHEET,MySheet,C,9");

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.