Run the following command in your Node-RED user directory (typically ~/.node-red):
npm install node-red-contrib-grovehat
This code is using the node-grovehat module: https://github.com/lavirott/node-grovehat
Use the Grove nodes in the Grove Panel.