Thursday, November 29, 2018

Helping a STEM student Arduino homework

A few weeks ago I responded on LinkedIn to someone who was looking for someone Arduino savvy. Turned out to be someone looking for help for her daughter that had trouble with a STEM course assignment.

Now I don’t usually do these kind of help. Most of the time it’s lazy students looking for someone to do their homework for them for free of 10$... I have been burned before.

But this time it was different. First it was the parent asking and after a few exchange I could feel that they were willing to put in the effort.

The task at hand was pretty easy. The student needed to reproduce an Instructable project based on an Arduino Uno, a 16x4 LCD and an analog joystick. The Instructable project was this one: https://www.instructables.com/id/Arduino-Looong-Snake-Game-With-LCD-16x4/

I first discovered that they and bought the wrong LCD and did not have the joystick part. I help them source it and during the time they waited for the parts I went on to build it myself. The hardware assembly was pretty straightforward and I had all the parts. Here is the Fritzing diagram:



Next I went on on compiling and uploading the code provided in the Instructable article. It did not work. The code was supposed to wait for you to select a level, but it would instead go straight to the game. Joystick did not work to control the snake… Then when I had that “Oh great, what did I get myself into” moment.

After a 30-40m adding debug print to the serial console and analyzing the code I figured out that the bugs in the code and just fixed it quickly. At least now the code was doing what it was basically designed to do. There are still some bugs in it where the snake jumps sideways, but the plan was never to fix it, just to get it working.

I did adjust the code writing style to match what I use so that it can be somewhat more readable. I did not add any comments or change the code structure.

You can download the fixed source code here: https://gitlab.com/IndianaTux/arduino-snake-game

Now the parent and her daughter got the parts but the male header is not soldered on the LCD and they have yet to find someone to do it. I’ll update this post with issues they went through as I help them out.


No comments:

Post a Comment

Day-O: A customizable macOS clock replacement

At work we use week number milestones. Finding which week we are in is always a pain... Until I found Day-O ( https://shauninman.com/archive...