Problem receiving structure from Serial Port via USB

This is my first post in this forum, so I apologize for any mistakes.
I am trying to make the Arduino receive a structure from my PC via USB
(it's about Euro Truck Simulator 2 game).
I have declared the structure at the top, but I receive an error message when compiling at

This is the code:

typedef struct ets2TelemetryMap_s
  unsigned int time;
  unsigned int paused;
    unsigned int ets2_telemetry_plugin_revision;
    unsigned int ets2_version_major;
    unsigned int ets2_version_minor;
  } tel_revId;

    bool engine_enabled;
    bool trailer_attached;
    // vehicle dynamics
    float speed;
    float accelerationX;
    float accelerationY;
    float accelerationZ;
    float coordinateX;
    float coordinateY;
    float coordinateZ;
    float rotationX;
    float rotationY;
    float rotationZ;
    // drivetrain essentials
    int gear;
    int gears;
    int gearRanges;
    int gearRangeActive;
    float engineRpm;
    float engineRpmMax;
    float fuel;
    float fuelCapacity;
    float fuelRate;       // ! Not working
    float fuelAvgConsumption;
    // user input
    float userSteer;
    float userThrottle;
    float userBrake;
    float userClutch;
    float gameSteer;
    float gameThrottle;
    float gameBrake;
    float gameClutch;
    // truck & trailer
    float truckWeight;
    float trailerWeight;
    int modelType[2];
    int trailerType[2];     // ! deprecated
  } tel_rev1;

    long time_abs;
    int gears_reverse;
    // Trailer ID & display name
    float trailerMass;
    char trailerId[64];
    char trailerName[64];
    // Job information
    int jobIncome;
    int time_abs_delivery;
    char citySrc[64];
    char cityDst[64];
    char compSrc[64];
    char compDst[64];
  } tel_rev2;

    int retarderBrake;
    int shifterSlot;
    int shifterToggle;
    int fill;
    bool cruiseControl;
    bool wipers;
    bool parkBrake;
    bool motorBrake;
    bool electricEnabled;
    bool engineEnabled;
    bool blinkerLeftActive;
    bool blinkerRightActive;
    bool blinkerLeftOn;
    bool blinkerRightOn;
    bool lightsParking;
    bool lightsBeamLow;
    bool lightsBeamHigh;
    bool lightsAuxFront;
    bool lightsAuxRoof;
    bool lightsBeacon;
    bool lightsBrake;
    bool lightsReverse;
    bool batteryVoltageWarning;
    bool airPressureWarning;
    bool airPressureEmergency;
    bool adblueWarning;
    bool oilPressureWarning;
    bool waterTemperatureWarning;
    float airPressure;
    float brakeTemperature;
    int fuelWarning;
    float adblue;
    float adblueConsumption;
    float oilPressure;
    float oilTemperature;
    float waterTemperature;
    float batteryVoltage;
    float lightsDashboard;
    float wearEngine;
    float wearTransmission;
    float wearCabin;
    float wearChassis;
    float wearWheels;
    float wearTrailer;
    float truckOdometer;
    float cruiseControlSpeed;
    // General info about the truck etc;
    char truckMake[64];
    char truckMakeId[64];
    char truckModel[64];
  } tel_rev3;

    float speedLimit;
    float routeDistance;
    float routeTime;
    float fuelRange;
    float gearRatiosForward[24];
    float gearRatiosReverse[8];
    float gearDifferential;
    int gearDashboard;
  } tel_rev4; // added in sdk1.5

    bool onJob;
    bool jobFinished;
  } tel_rev5;

} ets2TelemetryMap_t;

// Some other declarations...

void setup(void)

void loop(void) {
  while (Serial.available() > 0) {;, sizeof(data));

And this is the error message:

exit status 1
no matching function for call to 'HardwareSerial::read(ets2TelemetryMap_t*, unsigned int)'

I have no idea what this message means and how I could solve the problem, and I am not sure if this is a right way to receive this data.
Any advice is welcome!

Thank you in advance

"(void*)" cast required?

Thank you for your quick reply!
Are you talking about the second void in void loop(void)?
If so, I did not write it in purpose; I didn't even noticed it because I copy-pasted the setup and void declarations from another working project.

Can you please post a complete program that illustrates the problem

"read" returns an "int" and takes no arguments.
Did you mean "write"?

(I admit, I saw the arguments, and read "write", not "read" (!))

Can you please post a complete program that illustrates the problem

Thank you for your reply!
I previously posted only some part of the project that I thought it was most relevant to the problem.
Anyway, here is the complete program as an attachment.

ETS2_Telemetry.ino (18.6 KB)

"read" returns an "int" and takes no arguments.
Did you mean "write"?

(I admit, I saw the arguments, and read "write", not "read" (!))

Hi! Yes, I really meant "read" and not "write", as I would like the Arduino to receive the data from the PC and not vice versa.
I thought "read" takes arguments... So this is the problem? :o

Start here

A single instance of that struct will occupy almost 1000 bytes of memory. What board are you using and how much RAM does it have?

I am using Arduino MEGA 2560.
Maximum (according to the compiler) is 8192 bytes. Currently, about 20% is used.

Start here

Thank your for this! :slight_smile:
I checked it out.
But how can I "match" the incoming data with the structure**?**
(I would like to do this because the structure contains a lot of variables and I wanted to avoid writing to them one by one.)