This week, I explored how software and hardware can communicate creatively through tools like Processing and p5.js. It was exciting to see how simple physical inputs, like pressing a button, could generate dynamic visual responses on screen.
Group assignment:
Individual assignment:
Assignment: IR Distance Sensor Display via Serial Communication
Processing is an open-source programming language and environment based on Java, mainly used in visual arts, interaction design, and creative coding. It's beginner-friendly and ideal for graphics, animations, and interaction with hardware like Arduino.
Using a button on a microcontroller as input, we created an interactive sketch in Processing to display randomly generated shapes and colors on the canvas.
"1\n"
) is sent via serial portp5.js is a creative coding library based on JavaScript, designed to make coding fun and accessible, especially for art, design, education, and beginners. It is the JavaScript version of Processing, led by Lauren McCarthy.
Feature | Description |
---|---|
🎯 Beginner-Friendly | Syntax similar to Processing, great for coding newbies |
🧠 Creativity-Focused | Perfect for visual arts, interaction design, data visualization, and sound |
🌐 Web-Based | Runs in browsers, no installation needed, easy sharing |
📦 Extensive Libraries | Supports images, sound, hardware (like Arduino), and 3D |
💬 Active Community | Plenty of open-source examples and learning resources |
Created and embedded multiple p5.js sketches in a single page via the p5.js Web Editor.
The Web is one of the most widely used platforms today. To support rich interactivity and visuals, the W3C has standardized technologies such as HTML5, CSS, and JavaScript.
HTML5 Canvas and WebGL are core graphics APIs:
These APIs form the foundation of advanced frameworks like p5.js, offering both low-level control and creative flexibility.
A WebGL-based animation that shows stars rotating around a 3D Earth. Includes adjustable sliders.
Another WebGL animation where stars orbit a 3D Sun. Includes sliders for scale, speed, star size, and Z-depth.
Individual assignment:
Display IR Distance Sensor Data via Serial Communication between Arduino & Processing,this assignment is to read the distance value from an infrared sensor using Arduino, send the data to Processing via serial communication, and visualize the distance in real-time.
Tools: Arduino UNO, Sharp IR Sensor, Processing
In this assignment, I successfully implemented serial communication between Arduino and Processing to display real-time distance readings from an IR sensor. The main challenge was handling the serial data format and converting it properly in Processing. I solved this by using bufferUntil('\n')
and trim()
to clean the incoming string. This exercise helped me better understand sensor data processing and visual feedback using code.