Introduction
This guide will walk you through the steps neccessary to connect your Bean to another device using Node-RED, a visual programming interface that requires very little coding experience.
Node-RED Basics
Node-RED is based on Node.js. The Node-RED application runs as a web server, and you customize and manipulate functional “flows” from any computer’s browser, local or remote. Every Node-RED app consists of nodes which are linked together to form the logical flow of your application. The nodes typically fall under input, operation or output.
Below is a very simple example of how these different nodes would interact with each other.
In reality, you wouldn’t have nodes with such generic names as “input” or “output”. At Punch Through we have created our own nodes which are specifically designed to communicate with Bean.
- Acceleration: Get accelerometer data from Bean.
- Serial: Send or recieve serial messages to or from Bean.
- Temperature: Get the ambient temperature from Bean.
- Read Scratch: Read scratch data set by Bean.
- RGB LED: Set Bean’s LED to a specified color.
- Write Scratch: Write scratch data to Bean.
Each of the nodes defined above can be used in a Node-RED application once you install these nodes into your Node environment. We will cover installation and setup in following sections.
Check out the following example of a Node-RED app that grabs temperature data from Bean and tweets it! Connecting your Bean to the internet can be as easy as this.
FOr More Details: What is Node-RED?