Interface and Application Programming
For this week's assignment, as a group we had to compare as many tool options as possible, and individually write an application that interfaces a user with an input or output.
Individual AssignmentThis week was another interesting one for me. It was heavy in both coding and working with terminal, which I'm not very experienced with. On top of that, our node used Python for the interface, which I have exactly 0 experience with. In short, thank goodness Professor Goodman was here to help me or I would be completely lost.
For the code for this week, I decided to have nu,bwered buttons and the led on my board would blink the same number of times as whatever the number on the button was. I used the same sort of serial monitor input code as last week but altered the blinking function to match what I wanted.
I started the second part of this week by going to install serial using python on my computer. Since I'm using a Mac, I had both python and python 3 installed. Right off the bat I had issues with getting the specific files installed and running on my machine. I could install serial on python 3, but when I went to create a gui using tkinter, it wouldn't work because tkinter wasn't on that version of python.
Because this was an issue with the newer version of python, I went to use python 2, but I couldn't install serial because there was an issue with pip. This was all over my head, so I went to Professor Goodman. He looked at the location of python 2 on my computer and found that for whatever reason pip wasn't even installed.
After doing a bit more searching around in terminal, and then looking online he found this resource which showed how to install pip on my computer. We downloaded the file and ran it in python, and it worked!
Since my python and terminal issues were fixed, I could go ahead and import serial to get started on actually running my gui!
My interface design was relatively simple. Since the led would blink depending on what number was inputted, I made my buttons look like a keypad using the grid function in python. This meant that for all of my buttons, I specified the row and column in the grid that they would show up in.
This is what it looked like on the computer!
I ran this file in terminal and it worked perfectly! You can see my board blink depending on which button was pressed below!