Arduino Code implementation on the project

#include <Wire.h>
#include <SPI.h>
#include <Servo.h>
#include <HMC5883L.h>
#include "LabVIEWInterface.h"

HMC5883L compass;
int error = 0;

unsigned long millis_readsample = 0;
unsigned long freq_readsample = 100;

/*********************************************************************************
** setup()
*********************************************************************************/
void setup()
{
// Initialize Serial Port With The Default Baud Rate
syncLV();

// Place your custom setup code here
Wire.begin();

compass = HMC5883L();
error = compass.SetScale(1.3);
error = compass.SetMeasurementMode(Measurement_Continuous);
millis_readsample = millis() + freq_readsample;
}

/*********************************************************************************
** loop()
*********************************************************************************/

void loop()
{
float var;

// Check for commands from LabVIEW and process them.
checkForCommand();

// Place your custom loop code here (this may slow down communication with LabVIEW)
if (millis() >= millis_readsample)
{
MagnetometerScaled scaled = compass.ReadScaledAxis();
int xScaled = scaled.XAxis;
int yScaled = scaled.YAxis;

serialWriteFloat((float)xScaled);
serialWriteFloat((float)yScaled);

millis_readsample += freq_readsample;
}
}

void serialWriteFloat(float arg)
{
byte * data = (byte *) &arg;
Serial.write (data, sizeof (arg));
}

I would like to ask for a detailed explanation of this code for my Magnetometer project . I don't understand Arduino's code implementation on the Labview software . Any help would be greatly appreciated !

This is the reference of the Serial.write() : Serial.write() - Arduino Reference

In the code, the function serialWriteFloat() transmits 4 bytes of a binary float number. If it is for an Arduino Uno, a float is 4 bytes, I don't know what it is for others.
The 'data' variable is a byte pointer, and the sizeof() of a 'float' is 4. The byte pointer points to the begin of the 4 bytes of the float number.

Thanks! I see , yes I'm using arduino uno .
what about this section ?
void setup()
{
// Initialize Serial Port With The Default Baud Rate
syncLV();

// Place your custom setup code here
Wire.begin();

compass = HMC5883L();
error = compass.SetScale(1.3);
error = compass.SetMeasurementMode(Measurement_Continuous);
millis_readsample = millis() + freq_readsample;
}

The syncLV() seems to be some kind of initialization function. Perhaps it is in a library that comes along with the LabVIEWInterface.h

The compass seems to be some kind of c++ object (a class). It is probably in the library that comes along with HMC5883L.h

The SetScale() and SetMeasurementMode() are functions of that object.

The millis() function returns the number of milliseconds that starts counting when the sketch starts running on the Arduino. It can be used for software timing, for delays, and many more. I have no idea how it is used in that code.

When you add a library to the Arduino IDE (either with the Library Manager or by opening a Library *.zip file) then new examples are added to the menu of the Arduino IDE. That way you can try the examples and learn how to use the library.

The <Wire.h>, <SPI.h>, and <Servo.h> are libraries that are included with the Arduino software. The other two are perhaps libraries that needs to be installed, or they are *.cpp files that are included in the project.
Without knowing those unknown libraries, you might have grabbed some code from the internet. Or perhaps an old version of a library.