Go Down

Topic: (updated)Help on Serial communication between Arduino and PC!! (Read 1 time) previous topic - next topic

skyjumper


dxw00d

The 'which IDE?' question hasn't been answered yet, so we don't know what the Serial.flush() is doing.

PaulS

Code: [Select]
class SensorData SD0;
I don't know exactly what this is doing, but I do not think that it is doing what you expect. It is not the correct syntax for declaring an instance of the SensorData class.

A class instance has data and methods.

Code: [Select]
    SD0.readSensor();
   
    Serial.write((byte *)&SD0, sizeof(SD0));

Sending the whole instance, data and methods, hardly seems useful. What is the receiver going to do with the methods?

With no length sent, or start and end markers, how can you expect to know when the complete packet has been received?

Nick Gammon

I was wondering that too, but he said it worked OK.

Quote
below is the code I used on Mega, it worked perfectly.


So who am I to argue with the OP?

Nick Gammon


Sending the whole instance, data and methods, hardly seems useful. What is the receiver going to do with the methods?


I'm not sure the class data holds the methods per se, but what it does hold is probably implementation-defined.

Go Up