Example Code for UNIHIKER K10&M10 - Servo

Last revision 2026/02/03

Guide to control servos using UNIHIKER with code.

Hardware Preparation

If Using UNIHIKER K10

  • UNIHIKER K10 * 1
  • Multi Function Expansion Board for UNIHIKER * 1 (Both “For the UNIHIKER K10-Only” and “For the UNIHIKER K10 & M10” are supported, but “For the UNIHIKER K10 & M10” is recommended, as it allows for easier program uploading and debugging even when using only the K10)

If Using UNIHIKER M10

Note: The multi-functional expansion board requires separate power supply when IN use. It can be powered by installing an 18650 battery or from the USB IN of the expansion board, and the PWR power supply switch needs to be turned on.

Extra hardware

Software Preparation

If Using Mind+

  • Mind+ Download
    • Mind+ User Extension: https://github.com/YeezB/ext-UnihikerExpansion

If Using Arduino IDE

Hardware Connection

Use UNIHIKER K10 & Mind+

Use UNIHIKER K10 & Arduino IDE

#include "DFRobot_UnihikerExpansion.h"
DFRobot_UnihikerExpansion_I2C eunihiker(&Wire);
void setup()
{
	Serial.begin(115200);
	while(!eunihiker.begin()){
		Serial.println("NO Deivces !");
		delay(1000);
		} 
	Serial.println("Device connected !");
	eunihiker.setServo360(eServo0, eForward, 50);
}

void loop()
{
	eunihiker.setServoAngle(eServo1, 90);
	delay(1000);
	eunihiker.setServoAngle(eServo1, 180);
	delay(1000);
}

UNIHIKER K10 Result

Use UNIHIKER M10 & Mind+

Use UNIHIKER M10 & Python

import sys
sys.path.append("/root/mindplus/.lib/thirdExtension/drobot_yeezb-unihikerioexpansion-thirdex")
import time
from pinpong.board import Board
from dfrobot_unihiker_expansion import UnihikerExpansion, ServoNum
from pinpong.board import Board
from dfrobot_unihiker_expansion import UnihikerExpansion, ServoNum, Servo360Direction

Board("").begin()

eunihiker = UnihikerExpansion()
eunihiker.set_servo360(ServoNum.SERVO0, Servo360Direction.FORWARD, 50)
while True:
    eunihiker.set_servo_angle(ServoNum.SERVO1,90)
    time.sleep(1)
    eunihiker.set_servo_angle(ServoNum.SERVO1,180)
    time.sleep(1)

UNIHIKER M10 Result

Was this article helpful?

TOP