Example Code for UNIHIKER K10 - On-board RGB LED

Guide to controlling RGB LEDs on UNIHIKER K10.

Hardware Preparation

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.

Software Preparation

If Using Mind+

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

If Using Arduino IDE

Use UNIHIKER K10 & Mind+

Use UNIHIKER K10 & Arduino IDE

#include "DFRobot_UnihikerExpansion.h"
DFRobot_UnihikerExpansion_I2C eunihiker(&Wire);
uint32_t led[2] = {0x000000, 0x000000};

void setup()
{
	Serial.begin(115200);
	while(!eunihiker.begin()){
		Serial.println("NO Deivces !");
		delay(1000);
		}
}

void loop()
{
	led[0] = 0x0000FF;
	eunihiker.setWS2812((uint32_t*)led, 5*25);
	led[1] = 0x0000FF;
	eunihiker.setWS2812((uint32_t*)led, 5*25);
	delay(1000);
	
	led[0] = 0xFF0000;
	eunihiker.setWS2812((uint32_t*)led, 5*25);
	led[1] = 0xFF0000;
	eunihiker.setWS2812((uint32_t*)led, 5*25);
	delay(1000);
	
	led[0] = 0x33CC00;
	eunihiker.setWS2812((uint32_t*)led, 5*25);
	led[1] = 0x33CC00;
	eunihiker.setWS2812((uint32_t*)led, 5*25);
	delay(1000);
}

UNIHIKER K10 Result

Was this article helpful?

TOP