PureData – Tutorial from scratch

PureData Help patch

Click to enlarge

This section will teach you how to get a PureData patch going from scratch, assuming that a Senseworld Datanetwork host is currently running and that there is a node to subscribe to.

First, create a new patch and add a private variable called dn-host with the host’s IP address as a creation argument. This variable will be referenced by all of your node and makenode objects.

Similarly, make a private variable for the name of your client, in this case HelloSenseWorld.

Now add your first dn.node object, which should cause a terminal output as shown below. Its creation argument is the node ID on the network, in this case 103. In my case, this node is a minibee with a light sensor on it.

You can see here how the data from the node is now available for use. Let’s make a very simple example of how to process this data and re-publish it as a new node, which will demonstrate the use of multiple nodes and a makenode in the same patch.

This patch simply takes the light level output of node 103, checks to see if it is above a certain threshold, and then outputs the result of the threshold comparison to a new node. Notice the creation arguments of our dn.makenode object: first the makenode ID (arbitrary but should be unique: I’ve chosen 789) and then the number of slots (just one for now).

Here we have made a second dn.node object to show how our dn.makenode is publishing data. Currently the light level is too low to pass the threshold, but soon it will be brighter, and oh what a time we will have!

Wow! Check out that thresholding action. In your applications of these concepts you’ll probably be doing more than just checking a light level. Hopefully this tutorial will have given you a starting-off point from which to build your SenseStage project!

Be safe, and keep on multiplexing!

Comments/Questions

Comments are closed.