In this project you are going to connect an LCD to your board and write a short message on it.
The LCD in the kit is connected to a port expander (MCP23008). This allows the LCD to be controlled via the I2C protocol, thus reducing the number of pins you need to connect the LCD to. In this case, you just need to connect the expander to GND, 5V, SCL and SDA pins, according to the indicators on the expander. You can find the appropriate pins in the Pin Layout tab. You just need to connect the SDA port on the port expander with the SDA pin on the board and so on.
First of all, you need to initialise the LCD. For this, you drag the run node and select Fire once at start so you make sure that once you run the application a first message is sent. This is only required to trigger the init LCD node, so you can assure there is no other message being sent again. For this, drag the trigger node and double click on it.
You need to set this node to wait until reset. This will make the node to send the first message and then wait until it receives a message containing the property reset, which will never happen. Next, the init LCD node initializes the LCD.
First of all, you need to require the wyliodrin module, which exposes some simple functions in order to control the LCD. Otherwise you would need to implement the protocol in order to control it.
Once you have the wyliodrin variable, call the LiquidCrystal constructor in order to obtain a LiquidCrystal object. The constructer receives 0 as parameter.
Why is the value 0 the parameter of the contructor? This type of LCD communicates with the Raspberry Pi board via that I2C protocol. Taking into account how the I2C protocol behaves, you would need to mention the bus specific to the LCD, that usually is 32. However, in order to be able to connect multiple LCDs at once, they have three jumpers which can be connected in order to represent values from 0 to 7, thus being able to identify eight different LCDs. This is the value you need to pass to the constructor, in this case, no jumper is connected so we passed the value 0.
What is new at the code presented above is the context.global.lcd structure. You need to use this because you want the lcd variable to be available from other nodes also (Display on LCD node) and context.global is a variable accessible to all the nodes, so you just set the lcd property and you will be able to use it from any other node.
The display LCD node is another function node which first clears the LCD, then prints a string on it. Notice that the global lcd variable is used.