Communications

The Arduino can use the same USB port and cable as is used for uploading sketches for communicating with the desktop computer and apps that are running there. Unfortunately, there are usually restrictions on allowing web pages and Javascript to use this kind of communication. We will have to run a special app that acts as a go-between. The app is available from this site on GitHub:

Look for p5.serialcontrol-win32-x64.zip

Once you have downloaded this zip file and have expanded the contents, look for the executable file (app) called p5.serialcontrol. You will need to run this app to allow the communication to take plase, but only AFTER you have completely finished uploading a sketch to the Arduino. These two different uses of the USB cable will interfere with each other.

The other thing you will need is an extra library called p5.serialport.js. You can get this library from your teacher and you should put that file with the other p5.js libraries, then include a link in the index.html file, just like you do for other libraries like dom or sound.

Finally, you will need to write some matching code both in p5 Javascript for your web page and for the Arduino so that the two things can communicate with each other.

Back to the main menu.