UART - Send and Receive

Materials

  • AmebaD [ AMB23 / AMB21 / AMB22 / BW16 / BW16-TypeC ] x 1
  • USB to TTL Adapter x 1

Example

UART is a very versatile communication protocol and almost an essential part of a microcontroller. A TTL USB to Serial module is an IC that helps to translate UART signal to USB signal so that we can see uart log printed on our PC. This module is often found on many development boards, including ameba. However, the module on Ameba is reserved for LOG UART and Firmware uploading, that is why we need a separate module to communicate between ameba and PC.

Code

Copy and execute each line one by one to see its effect.

from machine import UART
uart = UART(tx="PB_1", rx= "PB_2")
uart.write('hello')
uart.write('123')
Please confirm that QQ communication software is installed