From my understanding, serial.write writes binary data to the serial port and serial.print prints data to the serial port as human-readable ASCII text. In my code, I am suppose to get 128 samples or 128 bytes in a read out period. This is when serial.write is used. If I changed the serial.write command to serial.println, it prints around 40 integer values each read out period. The image is a sample of the output in the serial monitor.
I am puzzled on the output difference between serial.write and serial.println. Why has the total samples been reduced from 128 bytes to 40 integer values when using serial.println? Did serial.println grouped 3 bytes and convert them into 3 ASCII text?
Is there a way where I can view what has been written with serial.write?
1) virtual size_t write(uint8_t) ; // write one byte
2) virtual size_t write(const char *str); // write a zero terminated char array
3) virtual size_t write(const uint8_t *buffer, size_t size); // write size bytes from byte array
These are the lower level primitives and the Serial.print(all types) uses these write functions to implement their functionality.
In fact (2) and (3) uses (1) under the hood.
so Serial.write(byte) is the "lowest" level function and it is the function that talks to the object specific output code (call it driver) either a Serial port or a LCD or 7segment or disk.
In practice the write functions are often used to write binary data where the print functions are often used for human readability.