Skip to main content

Library Creation

Libraries are nodes created by a group of nodes which can be re-used at other parts of the code. They are like functions in C language.

Libraries can take inputs and give outputs of data. Each library node is made available on the palette once created.

Steps

  1. We'll create a blink library as an example.
  2. Click + sign near input on the toolbar above the canvas area.

node props


  1. Reposition the new input node to centre.
  2. Similarly add an output node and reposition it.
  3. Double click the output node to open its properties.
  4. Edit its label to eg. "Done".
  5. Click pencil icon button in New Library Name property.
  6. Set a name of your new library eg. "blink".
  7. Below Properties property, click Add button.
  8. Set name of the property, in our case keep it pin.
  9. Set its data type. In our case Integer of subtype uint8.
  10. Set its default value eg. "2".
  11. Click Add button to close editor of the new library.
  12. The new library will be selected in the output node's properties.
  13. Click Done button to close editor of the output node.
  14. Open properties of our input node.
  15. Ensure its New Library Name property is pointing to our "blink" library name.
  16. Click Done to save the suggested value of New Library Name.

Lets add actions to be performed by the library.

  1. Create a sequence of nodes between our input node and output node:

input node -> pin write -> delay -> pin write -> output node

  1. Set Pin of the 1st pin write node as pin (corresponding to our library's property).
  2. Set Level of the 1st pin write node as 1 (HIGH).
  3. Similarly, for 2nd pin write node, make the properties pin and 0 respectively.
  4. Set Period of delay node as 0.1 (0.1s).

The Library is ready! Lets Use It.

  1. Find the library named "blink" in the left side palette. (Use it like a normal node)
  2. Create a flow: on interval -> blink.
  3. Set Interval property of the on interval node as 1 (1s).
  4. Set Pin property of blink node as 2 (or any pin with an LED connected).
  5. Use node properties the inside nodes.
  6. Compile and upload the code to your microcontroller board to see the blinking working.

Congratulations on creating your 1st library!

How to Send Data output from library

  1. Open properties of output node from the above example.
  2. Click pencil icon button in New Library Name property.
  3. Below Output Props property, click Add button.
  4. Set index of the bubble you want an output data for. Eg. 0 for the 1st bubble.
  5. Set its name eg. data.
  6. Select its data type. Eg. uint8 (Integer).
  7. Add a node that creates a variable when added in the flow eg. pin read node.
  8. Add the node between the input node and output node of the library. Eg: input node -> -> other nodes -> pin read -> output node.
  9. Open properties of pin read node.
  10. Set properties of the node as wanted by you.
  11. Go to Outputs section of the properties.
  12. Set variable name of the Pin Level output prop to data so that it creates a variable named "data" which will be given as output of the library.
  13. Done! You can now assign this variable to the node properties of the next connected nodes of blink where its used.
  14. Use the output variable named "data" of the new blink node like any other normal node in your code.
note

Libraries currently don't support more than 1 output bubbles.



note

Names of Properties and Output Props of created new libraries shouldn't contain spaces or special characters. Names should start with an alphabet and the names can contain underscores "_" or numbers in them.



Init Node

Use an init node instead of an input node to create a flow (for your library) that executes during initialisation (setup) phase of the microcontroller's code execution. Ensure the New Libary Name property of the init node is pointing to the correct library. Flows created with init nodes shouldn't be ended with an output node.

Creating Different Node Types

Activity NodeEvent NodeConfig Node
Flow starts withinput nodeAny Event type nodenone
Flow ends withoutput nodeoutput nodenone
#Input Bubbles100
#Output Bubbles0/10/10
Node Properties
Output Properties