During this workshop, you will start from a p5.js starter template. and hook it up to receive IMU data.

Goals:

A. Create a new p5.js project

In this section, you will create a project folder on your disk that includes the index.html and sketch.js files that you need in order to a run a p5 sketch. (These are similar steps to the ones you used in the workshop Setting up an IMU, except that you've already set up Visual Studio code.)

  1. Open a new terminal window. (Or, use cd to change an existing terminal window to the directory in which you want to create the new project folder; for example, just cd to move the terminal to your home direcgtory.)
  2. In the terminal git clone <https://github.com/osteele/p5-module-template.git> imu-workshop. This creates a local folder named imu-workshop, that has the files for a minimal p5.js sketch.
  3. In Visual Studio Code, open the imu-workshop folder.
  4. In Visual Studio Code, click the "Go Live" button.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d3447211-c261-47d9-8bc8-e9a160d961b4/Untitled.png

  1. Modify sketch.js so that something appears on the screen.

B. Subscribe to sensor data

We will use the imu-tools npm package to subscribe to IMU data that is coming from the network. This involves adding the imu-tools npm package to our project, so that we can write code that calls functions in this library; and specifying the connection address of a network server.

  1. Follow the instructions on the imu-tools project page to add the package to your project.

Note: You will need to add lines to both index.html and sketch.js