mLink library for mLink modules

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

mLink library for mLink modules

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

[IMAGE TBA]



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)



Using the mLink library


Step 1) Downloading the mLink library

Download the mLink.zip library from the following link.

https://hobbycomponents.com/downloads/mLink/mLink.zip

Save it to somewhere convenient on your computer.



Step 2) Installing the mLink Library

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:
Documents/Arduino/libraries/

Linux:
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"
  3.  
  4.  
  5. //Step 2: Create an instance of the library
  6. mLink mLink;
  7.  
  8.  
  9. void setup()
  10. {
  11.   // Step 3: Initialise the library  
  12.   mLink.init();
  13. }
  14.  
  15.  
  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