Node-RED introduction

From Sensors in Schools
Jump to navigation Jump to search

Overview

  • The aim of this lesson is to start learning to use Node-RED which is a block-based programming language.
  • The appeal of Node-RED is that individual code segments are hidden in nodes.
  • Individual nodes can be connected using wires.
  • This makes the program much easier to visualise and program.

Learning Objectives

  • Learn how to start node-red on the Raspberry Pi.
  • Learn how to run Python programs in Node-RED.

Introduction to Node-RED on the raspberry Pi

  • Node-RED is a powerful and intuitive programming language pre-installed on the Raspberry Pi.
  • This lesson will serve as an introduction to the use of this platform.
  • In this lesson we will learn how to execute python programs.

Run the python file peter_hopper_get_data.py

  • From the main Raspberry Pi menu navigate to Programming and open Python3 IDLE
  • Open the saved file peter_hopper_get_data.py
  • The full listing is below.

  • Run the program by selecting Run > Run module.
  • The program will send output to the Python Shell.
  • A typical output in the Shell is presented below.