Sarah - Processing Programming language
For this week’s group assignment, my task was to use Processing with an input or output.
Processing is an open-source IDE and programming language used to create Human-Machine Interfaces (HMI).
Why it’s favorable for fab academy projects
- Bridge to Hardware: It translates serial data from a custom PCB (like the ESP32-C3) into visual feedback (graphs, colors, or shapes).
- Rapid Prototyping: Its Java-based syntax is very similar to Arduino (C++), making it easy to "sketch" an interface quickly.
- Visualizing Data: It moves your documentation beyond just blinking LEDs by creating a dashboard to monitor and control your electronics.
- Cross-Platform: The interfaces you build work on Windows, macOS, and Linux, supporting the Fab Lab philosophy of reproducible documentation.
Test 1: Processing for controlling an LED with an ESP32-C3
Step 1: Software Installation & Setup
To get my ESP32-C3 talking to Processing, I need to prepare both environments.
- Install the Arduino IDE
- Install Processing: Download and install the latest version from processing.org.
- Install the ESP32 Board Manager:
- In Arduino IDE, go to File > Preferences.
- Add this URL to "Additional Boards Manager URLs":
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Go to Tools > Board > Boards Manager, search for "ESP32-C3," and install the package by Espressif Systems.
- Identify the Port: Plug in the ESP32-C3 and go to Tools > Port in the Arduino IDE. Note the name (e.g.,
COM11 on Windows). You will need this exact string for the Processing code.
Step 2: The ESP32 "Receiver" Code
In this step, we will program the ESP32 to listen for a specific character sent over the USB cable (Serial) from the computer.
- Connect an LED to a digital pin (e.g., GPIO 2) with a 220Ω resistor.
- Open Arduino IDE and paste the following code:
const int ledPin = 2; // Change to your LED pin
void setup() {
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
char data = Serial.read();
if (data == 'H') {
digitalWrite(ledPin, HIGH);
} else if (data == 'L') {
digitalWrite(ledPin, LOW);
}
}
}