VIS 160 Senior Project - Virga
ChatGPT 3.5
We used ChatGPT 3.5 to assist with coding and technical support. This involved a certain amount of "prompt engineering" since the code did not exactly suit our needs right away.
Button Code
Version 2-1-24
Prompt 1: I need to create a system that has two physical button/sensor inputs that have a pausing effect on two videos that are being projected onto a wall. When a person presses one button, it pauses one of the videos while the other video continues. While both buttons can be pressed at once, only the first button to have been pressed will have any effect on pausing the videos. Therefore, only one video can be paused at once. Please create a p5.js code that can reflect this. Or, if you recommend another program, tell me.
-
Certainly! You can use p5.js to create this interactive system. Here's a simple example code to get you started. This code assumes you have two buttons (represented as sensors in this case) and two videos. The videos will play simultaneously, but pressing a button will pause the corresponding video.
-
(Example Javascript Code)​
-
​
Prompt 2: How do I get the button press data to p5js?
-
To get button press data to p5.js, you can use physical buttons or sensors that are connected to your system. These buttons or sensors should trigger specific actions in your code when pressed. Here's a general guide on how you might achieve this
-
Connect physical buttons or sensors
-
Read button/sensor input
-
Send data to p5.js
-
(Example Javascript Code with button SendButtonData function)
-
​
Prompt 3: Yes I will be using two Arduino buttons and will need to send the data to p5js via serial communication. Please generate the Arduino code and the p5js code accordingly.
-
Here's an example of Arduino code to read the state of two buttons and send the data via serial communication. Also, I've provided a corresponding p5.js code to receive and process the data.
-
(Example Arduino and Javascript Code with Serial Communication button integration)​
-
​
Connecting Arduino to p5.js
Version 2-20-24
Although we eventually decided to use app-based Processing over web-based p5.js, we utilized ChatGPT to help debug and guide us through using Github to clone the Serial Server repository, eventually getting it to work on our Mac. This was an important test to run, before moving everything to the Raspberry Pi, as it ultimately helped push us to using Processing over p5.js to eliminate web-related concerns.
UPDATE:
Prompt 1: I need to create a system that has two physical button/sensor inputs that have a pausing effect on two videos that are being projected onto a wall. When a person presses one button, it pauses one of the videos while the other video continues. While both buttons can be pressed at once, only the first button to have been pressed will have any effect on pausing the videos. Therefore, only one video can be paused at once. Please create a p5.js code that can reflect this. Or, if you recommend another program, tell me.
-
Certainly! You can use p5.js to create this interactive system. Here's a simple example code to get you started. This code assumes you have two buttons (represented as sensors in this case) and two videos. The videos will play simultaneously, but pressing a button will pause the corresponding video.
-
(Example Javascript Code)​
-
​
Prompt 2: How do I get the button press data to p5js?
-
To get button press data to p5.js, you can use physical buttons or sensors that are connected to your system. These buttons or sensors should trigger specific actions in your code when pressed. Here's a general guide on how you might achieve this
-
Connect physical buttons or sensors
-
Read button/sensor input
-
Send data to p5.js
-
(Example Javascript Code with button SendButtonData function)
-
​
Prompt 3: Yes I will be using two Arduino buttons and will need to send the data to p5js via serial communication. Please generate the Arduino code and the p5js code accordingly.
-
Here's an example of Arduino code to read the state of two buttons and send the data via serial communication. Also, I've provided a corresponding p5.js code to receive and process the data.
-
(Example Arduino and Javascript Code with Serial Communication button integration)​
-
​