mLink Arduino library for mLink modules

Useful guides, libraries, and example sketches to support our Arduino based products.
Post Reply
Site Admin
Posts: 867
Joined: Sun Aug 05, 2012 4:02 pm

mLink Arduino library for mLink modules

Post by admin » Mon Oct 04, 2021 2:29 pm


Arduino library for Hobby Components mLink range of modules. This library currently supports the following mLink products:

mLink 12 Bit port expander (SKU: HCMODU0180)
mLink DHT22 temperature and humidity sensor (SKU: HCMODU0181)
mLink 1 channel relay module (SKU: HCMODU0182)
mLink 2 channel relay module (SKU: HCMODU0183)
mLink 4 channel relay module (SKU: HCMODU0184)
mLink RGBW light controller (SKU: HCMODU0185)
mLink NTC temperature sensor (SKU: HCMODU0186)
mLink Matrix 4x4 keypad (SKU: HCMODU0188)
mLink 1602 & 2004 Character LCD (SKU: HCMODU0190A & HCMODU0190B)
mLink 12864 Graphics LCD (SKU: HCMODU0189)
mLink 6 Button Keypad (SKU: HCMODU0193)
mLink Home Sensor (SKU: HCMODU0198)
mLink TMP36 Temperature Sensor Module (SKU: HCMODU0187)
mLink L9110 DC Motor Controller (SKU: HCMODU0199)
mLink WS2812 RGB LED controller (HCMODU0197)

Using the mLink library

Step 1) Downloading the mLink library

The library is available via several sources:

1) The latest version of the library can be downloaded from our forum here: ...

2) Via our github page here:

3) For PlatformIO users you can add the library to your project by going to the library section of PlatformIO and searching either 'hobbycomponents' to view a list of our libraries or 'mLink' to just list the mLink library.

Step 2) Installing the mLink Library to the Arduino IDE

Once downloaded, open up your Arduino IDE and go to Sketch->Include Library->Add .ZIP Library.

In the file selection dialogue window that opens up, navigate to wherever you downloaded the mLink .zip file and select it, then click the ‘Open’ button.

Alternatively you can just unzip the library into your Arduino library folder usually found in the following location:

On Windows:
My Documents\Arduino\libraries\

On Mac:

Usually found within the users home area under /Arduino/libraries/

Step 3) Including the mLink library in your sketch

Adding the mLink library to your sketch consists of 3 steps; Firstly, include the mLink header file (mLink.h) at the top of your sketch, create an instance of the library, then finally initialise the library inside the startup() function:

  1. // Step 1: Include the mLink library
  2. #include "mLink.h"
  5. //Step 2: Create an instance of the library
  6. mLink mLink;
  9. void setup()
  10. {
  11.   // Step 3: Initialise the library  
  12.   mLink.init();
  13. }
  16. void loop()
  17. {
  18. }

The mLink library can be used to control any type of mLink module. For specific instructions and example sketches for your mLink module please see the documentation in the products forum thread (https://hobbycomponents/com/mLink), or the example sketches found within the mLink library.

Diagrams, libraries, and example code are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

Post Reply

Return to “Arduino”