Example — [Arduino] Add a Third-party Library for an Arduino Extension

This page describes how to add a third-party library when you use mBlock 5 Extension Builder to create an Arduino extension. You can write a library (for example, test.h) and add it for an Arduino extension.

Step 1: Upload the library file

Click the Transcode setting stab on Extension Builder as shown in the following figure and click + in the Source file area to upload a file.

The names of the uploaded files are displayed as follows:

src/OfflineBroadcast.cpp

src/OfflineBroadcast.h

Step 2: Reference the file

Click the Block settings tab, and then click the Upload transcode tab. Quote the name of the uploaded header file in the include: field. Ensure that you enter the file name with quotation marks, that is "src/OfflineBroadcast.h".

Example

You can download the following Upload Mode Broadcast example extension, which is created for Arduino, and import it into Extension Builder for reference.

arduino_broadcast.rar

For details about how to import it, see "Importing an Extension into Extension Builder."

Was this article helpful?
0 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.