User Tools

Site Tools


nblocksstudio:new_node

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
nblocksstudio:new_node [2018/10/13 05:34]
engineer
nblocksstudio:new_node [2018/10/13 11:12] (current)
Line 1: Line 1:
 =====How to create a new Node===== =====How to create a new Node=====
-  * Create 2 files +  ​* Goto nStudio server http://​www.n-blocks.net/​panel.php?​p=author,​ Your Nodes, Upload New 
-    * nodeName.h +  * Define the node Name, Category, Inputs,​Outputs,​Parameters 
-    * nodeName.cpp+  ​* Create 2 files using the provided templates 
 +    * my_node.h 
 +    * my_node.cpp 
 +  * Then copy the .h and .cpp files to the directory "​mbed_code"​ inside your computer [this will not be needed in the future, the 2 files from the server will be automatically downloaded to PC] 
 +  * Add the new Node to the imported nodes at http://​www.n-blocks.net/​panel.php?​p=author 
 +  * If the studio is running in your PC then restart it to import the new node
  
-<​code>​ 
-#ifndef __MY_NODE 
-#define __MY_NODE 
- 
-#include "​mbed.h"​ 
-#include "​nworkbench.h"​ 
- 
-class nBlock_My_Node:​ public nBlockSimpleNode<​1>​ { 
-public: 
-    nBlock_My_Node();​ 
-    void triggerInput(uint32_t inputNumber,​ uint32_t value); 
-}; 
- 
-#endif 
-</​code>​ 
- 
- 
-<​code>​ 
-#include "​my_node.h"​ 
- 
-nBlock_My_Node::​nBlock_My_Node() { 
-    return; 
-} 
- 
-void nBlock_My_Node::​triggerInput(uint32_t inputNumber,​ uint32_t value) { 
-    if (inputNumber == 0) { 
-        output[0] = value; // transfers the input value to the output 
-        available[0] = 1;  // set the flag: we have data available in this output pipe 
-    } 
-} 
-</​code>​ 
nblocksstudio/new_node.1539423287.txt.gz · Last modified: 2018/10/13 10:34 (external edit)