Serial.print vs Serial.write
Serial.print vs Serial.write on Arduino What’s the difference? – In Arduino programming, we will use serial communication to be able to send and receive data between devices.
There are two basic commands for sending data on the Arduino programming platform, Serial.print and Serial.write. Both can play an important role in the process of sending data.
In the debugging process, serial.print and serial.write are very often used because they tell the workflow process of the program we are creating, which program block is still problematic.
then what exactly makes the difference between serial print and serial write?

What’s the difference?
Referring to the arduino referense page, the process for sending serial data is different in the output process.
Serial print vs Serial write, Serial.print will send data to the serial port in human-readable ASCII text and Serial.write will send data in binary.
Example of Serial Print:
- Serial.print (98)
It will gives “98” - Serial.print (1.2345)
It will gives “1.23” - Serial.print (1.234567, 5)
It will gives “1.23456”. the 5 after the comma display how many numbers after the point you want to display. - Serial.print (‘X’)
It will gives “X” - Serial.print (“Arduino32”
It will gives “Arduino32”
Example of Serial Write:
- Serial.write (1)
It will gives “0001” - Serial.write (98)
It will gives “01100010” - Serial.write (1.2345)
It will send data “1.23450005054473876953125E0” and gives the binary data “00111111 10011110 00000100 00011001” - Serial.write (‘X’)
It will output binary data “01011000” - Serial.write (“Arduino32”)
It will gives binary data “010000010111001001100100011101010110100101101110011011110011001100110010”
Other Parameters Serial Print
Apart from the examples mentioned above, there is one more feature when using the Serial.print command, which is to convert and display data in a certain format.
These formats include Binary, Hexadecimal, Octal, Decimal, displaying how much data is after the comma and storing the data in flash memory.
Here’s an example:
- Serial.print (98, DEC)
Then this will give the decimal value “98” - Serial.print (98, BIN)
This will give the binary value “1100010” - Serial.print (98, HEX)
This will give the hexadecimal value “62” - Serial.print (98, OCT)
This will give an Octal value of “142” - Serial.print (98.87898, 3)
This will give the float value “98,878” - Serial.print (98.87898, 5)
This will give the float value “98.87898” - Serial.print (F (“Arduino32”))
This will send the string “Arduin32” to flash memory.
Hopefully Serial print vs Serial write article can add to your insight into Arduino platform-based programming.
If this article is useful, please share it using the share button below.