Week Outline

  1. Wednesday: Global Class on Interface and Application Programming.
  2. Monday: Local Classes on Introduction to Interface and Application Programming with Processing, Programming with Python on Blender, and Programming with Processing, P5.js, and Python.
  3. Tuesday:
  4. Wednesday: Global Review.

Global Class

For this week's global class, Neil started by talking about some of the most generally used languages. He showed us some examples of codes and applications for the most popular languages. Then, he introduced multiple types of device interfaces and explained how they work.

Local Classes

Introduction to Interface and Application Programming with Processing

Dani started this week's Local Class by explaining what interfaces are and what they can consist of. He talked a little bit about how different programming languages work. Then, he dived into the workflow of developing an interface in order for us to understand how to develop this week's assignment.

Then, we decided to do some hands-on work, so we downloaded Processing to get started with graphical coding in Java. He ran us through the thought processing of developing the following script:

int brightness = 0;
int increment = 1;

void setup() {
size (200, 200);

background(brightness);
}

void draw() {

background(brightness);

brightness = brightness + 1;

if (brightness == 255) {
increment = -1;
} else if (brightness == 0) {
increment = 1;
}
}


Which runs as follows:


Programming with Python on Blender

Adai and Santi showed us multiple examples they have worked on or found where you can use Python on Blender for multiple interfaces so that we can see how 3D modeling can interact with electronics and programming.

This was the first example they showed us. It allowed them to turn on or off an LED strip by moving a switch on Blender. So the object on Blender had a restraint on the slider. Then there was a Python script on Blender that based on the slider's position, would send a 1 or a 0 through serial to a running script on Arduino IDE. This script was then running on an ESP32 that was connected to the LED script they were controlling.

This was the second example they showed us. So instead of controlling whether the whole LED strip would turn on or off, they could control specific LEDs on the strip. So they had a copy of the LED strip designed on Blender with a constrained arrow that could be dragged along it. As the arrow moved along, the python program on Blender would send numbers assigned to specific LEDs from mapping through serial to a script running on the Arduino IDE, so that the ESP32 with the connected LED reacted accordingly.

This was the third example they showed us. It allowed them to control the color on a Xiao's neopixel. So like the second example, it had a constrained arrow that could be dragged along the color strip. As the arrow moved across different colors, the python program on Blender would send RGB codes through serial to a script running on the Arduino IDE, so that the connected Xiao's neopixel changed colors accordingly.

This was the fourth example they showed us. So they had a cube on blender which they could move, and based on the cube's position across the X axis, an ESP32's LED would turn on or off. So the cube had a constraint on where it could be moved. If it was over the X axis, it would send a 1 and if it was below it would send a 0. So the python program on Blender used websockets to send this binary data to the ESP32 through wifi. As the ESP32 received 1 or 0, the light would turn on or off.

This was the fifth example they showed us. Through the phone, they were able to move an object on Blender by changin the phone's position. So they used an app called Sensor Server on the phone, which would send the data from the phone's gyroscope to the python websockets program. Based on the data this program was receiving, the object on Blender would move accordingly.

They showed us a couple of other examples and discussed the relevance of being able to do these types of things. Although I most likely won't be using this myself, it was really interesting to see everything that can be done this way.

Programming with Processing, Streamlit,

After our lunch break, Dani took over to dive deeper into Processing. He showed us how to look at the documentation on www.processing.org/reference. He ran us through examples of static drawing, interactive drawing, serial interaction with MCUs,

Assignments

1. Write an application that interfaces a user with an input &/or output device that you made.

2. As a group, compare as many tool options as possible.

The documentation of the work we did can be found here.