Week 12: Interface and Application Program 11/24/22 ~ 11/30/22


Neil's Python and JS code


I wanted to try using Neil's code to display my laser TOF sensor-based distance. First, I used mods (Neil's reference video) and loaded WebSocket serial, character parse, and bar graph blocks, and downloaded his JavaScript code. However, it didn't work on my computer because my initial Arduino code was different from Neil's code. Therefore, what was passed to mods was not interpretable via his JS script. I also tried his Python script but a similar issue arose. Therefore, instead of utilizing Neil's code, I moved on to create my code.


Processing Display


When I failed to utilize Neil's code, Anthony recommended using the Processing language, which was similar to Arduino but enabled communication within my computer with the data retrieved from my microcontroller. I never used Processing before, but by referencing example codes, I enjoyed playing with this new language. I first displayed the distance that was shown on my Serial monitor to a new screen. I loaded a background image and updated the distance based on the value read by the USB port.

code 1


Then, I wanted to modify the display so that it's somewhat similar to my final project (controllable mini-car). Therefore, I loaded a different background image with a car and moved the car based on the sensed distance.

code 2