After having spent the first few weeks thinking and conceptualizing I started prototyping a few weeks ago. After a few setback and a few wins I am back here to tell you what I’ve been doing.
I wanted to prototype one of the puzzles I want to incorporate into my project. I decided to begin with the most difficult one, the keypad – binary puzzle. In this puzzle you have to solve the binary code presented on a LCD screen to get the code for the keypad, which deactivates a digital hurdle. The difficulty in this puzzle was mainly in the programming, as I am not a very good programmer. I wanted the puzzle to generate a random 4 digit code, translate that into binary and then check if the entered code is correct or not. If it’s correct it should play a ‘correct’ melody on the buzzer, display a message on the LCD and send a signal to the computer that the puzzle is solved and after that cycle to a new password in preparation of a game reset (for the nest player). If the password is incorrect it needs to play a ‘incorrect’ melody and display a message on the LCD.
This was quite complicated, but eventually I managed to sort out the code, except for one little thing. I have a 16×2 LCD screen, exactly big enough to fit the 4 numbers in binary, but for some reason, it does not want to display the second half of the string on the second line. The exact same code, not embedded in the rest of the puzzle works fine, but as soon as I introduce it to my main code it fails. I will be asking people more skilled than me in electronics and programming to hlp me solve this mystery as I have been banging my head against this wall for over two weeks.
The biggest win was that my lazy solution for the Arduino-unity link worked perfectly and saved me a huge amount of time and headache. I bought an Arduino Leonardo, as it is HID compatible (meaning computers can read it as a keyboard). This made programming in unity so easy as I can just have the Leonardo output a letter when a puzzle is solved and have unity respond to Input.GetButton.
So in short I can just add more puzzles to the Leonardo and they will communicate flawlessly with unity. Oh and I made a very simple three button interface for people to control the character.
The sheer time I spend on the tiny problem of the LCD screen was not worth it, I should have paid closer attention to how much time I can afford to spend on these kinds of problems.