Serial communication¶
Arduino¶
Transmit¶
Serial.print
Syntax | Result | - |
---|---|---|
Serial.print(78) | 78 | |
Serial.print(78,DEC) | 78 | |
Serial.print(1.234) | 1.23 | |
Serial.print(1.234,2) | 1.23 | |
Serial.print(‘N’) | N | |
Serial.print(“Hello world.”) | Hello world. |
Serial.println
Syntax | Result | - |
---|---|---|
Serial.println(78) | 78_ (new line) | serial_print_line |
Serial.print(78\n) | 78_ (new line) | need to chack type “option + ¥” to \ |
Serial.write
Syntax | Result | - |
---|---|---|
Serial.write(1) | 0x01 | |
Serial.write(255) | 0xFF | 1 byte(0-255) |
Serial.write(256) | 0xFF | cannot send more than 1 byte |
Receive¶
Serial.read Serial.readString()
Last update:
June 28, 2022