15. Interface & Application Programming

Goals for the week:15

  • Write and application that interfaces a user with input and/or Output devices on a board that you made



  • For this assignment I decided to code a guessing game that interfaces with a user by using Leds.I planned out how it would work as described in the image above with the help of my teacher.The game is made for two players. One person had to select a word to be hidden then the other person has to guess what the word is. The game only gives the person guessing the word three guesses. If the person doesn't guess correctly the game would give the message "you lose". If the person guesses the word correctly the game would send the message "you win". There would also be leds to show if someone won or lost by having them being two different colors red and green.



    After planning out what to do I created the code in Arduino for the game with the help of my teacher. The code consists of how the system stores each of the guesses of the persons playing the game, The total length of the input word, storing the letters of the word.



    When the code was done I connected my board to my computer then went up to the tool bar on the top of the screen. In the tool bar I picked the board option as XiaoEsp32. When I clicked on the board option I clicked the right arrow next to the check mark to compile all of the code into my board.



    After compiling all of the code in my Esp32 board. I opened up Python and started to write some code to interact with the game in Arduino.When in Python I changed the code with the help of my professor by making sure the game was working on the Arduino part.



    After making the code in Python I gone to my terminal to make a message to Arduino. I did this by making the command python3 sendMessageToArduino.py. After doing this command I opened the serial monitor to the Arduino to start the game.I then started to type in one letter at a tyme. As you can see each try shows which place each letter would go for the word.



    When the game responds between the Arduinon and Python. I moved onto the next step and coded in a monitor to type in the lettering for the gmae.



    For the final step to show the output portion of the assignment I planned on the led on my costom board to be used as a indicator for the correct answer and the wrong answer. It didn't work because the led was automatically on when connected to my computer. So I just used a bread board by connecting two leds from the bread board to my costom board.