// Cambridge, MA

week 12: interface and application programming

this week's assignment was to write an application that interfaces a user with an input/output device of my design.
i had limited time this week because of holiday travel, so i decided to use the same board i made for input/output week, which is a basic thermometer using a thermistor setup + OLED:
i decided to work in python since i'm familiar with it, which meant i first needed to read in data from my board into python. using pyserial, this was pretty straightforward:
i then set up a basic html page with a websocket to display the temperature that i was reading from the board. this was also not too difficult.
so i decided to challenge myself a bit and learn Three.js, something i hadn't used before. i thought it would be cool to make a 3D model of an analog thermometer where the height of the "mercury" changes according to my temperature reading.
after a few youtube tutorials, some chatgpt, and trial and error, i had a basic model set up with lighting:
and with a little more experimenting i even had the model include text elements:
unfortunately, the websocket did not want to connect to my JavaScript file; i spent an hour troubleshooting to no avail.
luckily, i found a workaround where i was able to set up a websocket in the main html page, and then pass that data through as the html content to my JavaScript file, allowing me to adjust the height of my thermometer model accordingly. voila!