Communication with Arduino with the serial port provides mainly three functions:
- Serial.read()
- Serial.write()
- Serial.print()
The first one has already been discussed in the previous recipes, as it is used to communicate commands from Delphi to Arduino. Let's move on to the next two:
- Serial.write(): Writes binary data to the serial port. This data is sent as a byte or a series of bytes in order to send the characters representing the digits of a number to use the print() function instead (https://www.arduino.cc/reference/en/language/functions/communication/serial/write/).
- Serial.print(): Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character ...