User Tools

Site Tools


Connect Hichi IR to the Pi Pico


Ping-Pong string: Hello, Pico!

Should return:

send data Hello, Pico!
Received: b'Hello, Pico!'

The Code:

from machine import UART, Pin
import utime
# Define GPIO pins
tx_pin = 0  # GPIO pin for TX
rx_pin = 1  # GPIO pin for RX
# Initialize UART
uart = UART(0, baudrate=9600, tx=tx_pin, rx=rx_pin)
while True:
    # Send data
    data_to_send = "Hello, Pico!"
    print('send data', data_to_send)
    # Wait for a short duration (adjust as needed)
    # Check for received data
    if uart.any():
        received_data =
        # Process the received data here
        print("Received:", received_data.decode('utf-8'))
    # Wait for a short duration before the next iteration
ir-for-mary.txt · Last modified: 2023/11/18 15:29 by admin