Week 13: Physical Computing Continued

Review Research together


Before we get started, let’s quickly look through your teams are.na channel. Grey and I will talk to each team in more detail individually, but lets take a look at what everyone’s thinking. Maybe someone’s research might inspire you

Post all of your work to the are.na channel, and paste a link to your team’s are.na channel below:



Today we’re going to warm up and review a few ways of using the arduino with some analog tools and sensors. Then, we’ll learn how to sync communication between arduino and processing. Afterwards, I’ll meet with you about your projects and you’ll have time to work with both myself and with Grey.

So let’s begin! Follow along…

Theme of the Day



Exercise 1 – Pushing Button and Establishing Communication

Set up

Code is in: File / Examples / Basics / DigitalReadSerial

You’ll need to pull up the serial monitor to see this in action (shift command M)

Watch


Now let’s see how we can get this into processing…


Notice in our code that we have the serial.begin function. As mentioned in the video, this tells the computer at what speed we’re sending data to the computer from the Arduino. This is an important step in our experiments.

Now lets open up Processing. This should be installed on your computer already. If it isnt, download it from here

Processing is what we were using when we were using p5.js. While it’s a little different (p5 is javascript, processing is its own language), the way they’re written is the same. So, in other words, you already are comfortable writing processing because of your last project 👏 

To get processing to work, we first need to download a serial library, do this:

Code (let’s discuss)

import processing.serial.*;

//Declare global variables
//In order to listen to any serial communication, we need a Serial object – in this case we've called it myPort