Week 12 - Interface and Application Programming

Spoiler Alert: My final project makes an appearance in my work for this week, which I had to complete during overtime for reasons. My goal for this week's work is to display on my computer a model of all the runways. When LEDs light up on my physical KBOS airport model, the corresponding LEDs would show up as lit on my computer. I could also display this information in the form of a plane moving along the runway.

Anthony recommended that I use Processing, which is beginner-friendly and resembles Arduino. I referenced this tutorial.

Sending Data from Arduino to Processing

While sending data from Arduino to Processing, using the example code in the tutorial, at first I was getting "processing error opening serial port COM9 port busy" message. Turns out I can't have the Serial Terminal in Arduino open while trying to send information to Processing.

Arduino sending "Hello World" to Processing.

Sending Data from Processing to Arduino

When testing out data sending from Processing to Arduino, I modified the tutorial's example code to work with Neopixels. Unfortunately, this didn't work (even after I realized that I'd forgotten to plug my LED strip into my PCB), despite changing the baud rate from the example's 9600 to the 115200 that I've been using. Since my runway LEDs are lit up by Arduino code now anyway, it wasn't that necessary for me to use Processing to make LEDs light up, so I'll figure out this bug another time.

Giving LED Data to Processing

I took my LED code for my final project and modified it to send the index of the LED to Processing, which worked! Running my LED code with multiple runways at first made Processing go a bit haywire after a while; Processing would display the one LED number multiple times in one block of text. So I modified my runway start times such that only Runway 22R would light up, which worked.

Because the data I give to my final project spans 100 seconds, setting all the start times for a runway to a value greater than 100 essentially turns off that runway.

Telling Processing which LEDs are lit up, with one runway. Runway 22R is set to have a flight takeoff/land at 5, 25, and 75 seconds, while all other runways are off. Processing indicates that LED 6 is on at the time.

I tried to recreate the multi-runway bug to screenshot the results, but Processing had no issues with displaying this time, so I should just remember to document events as they happen.

Sidenote: I should stop Processing from running before I upload new code to Arduino.

Telling Processing which LEDs are lit up, for flights on all six runways. LED 79, which corresponds to Runway 33L, is currently lit up.

In the interest of time and my need to finish my documentation for my final project, I decided to stop here for now and create a pictoral visualization of my final project over IAP, so stay tuned for further updates!

Thanks to Anthony for the advice, and thank you Bo for the M&Ms.