Example Code for Using the External 3Pin Sensor

Last revision 2026/01/06

This article provides a comprehensive guide on using an External 3Pin Sensor with the UNIHIKER M10, including hardware setup, software instructions, and sample Python code to successfully read and print temperature and humidity data from a DHT11 sensor.

Hardware Preparation

Software Preparation

According to the Getting Started section in the UNIHIKER official documentation, it is recommended for beginners to operate according to the instructions in the Mind+ section. [Click to view]

The main process is: download and install MInd+ on your PC, open Mind+, switch to Python mode and Code page, click on the icon in front of Terminal, open the Connect Remote Terminal menu, and then connect the UNIHIKER. After that, you can create a new py file in the File System, write code and run.

Mind+ interface diagram

Wiring Diagram

Wiring Diagram

Sample Code


#  -*- coding: UTF-8 -*-
# MindPlus
# Python

import time
from pinpong.board import Board,Pin,DHT11
from pinpong.extension.unihiker import *

Board().begin()
dht1 = DHT11(Pin((Pin.P2)))

while True:
    print((str("temperature:") + str(dht1.temp_c())))
    print((str("humidity:") + str(dht1.humidity())))
    time.sleep(1)

Result

Read the temperature and humidity data of the DHT11 temperature and humidity sensor and print it on the terminal.

Result GIF

Was this article helpful?

TOP