Search This Blog

Monday, February 8, 2010

Troubleshooting, Problem Solving, Thinking Out Loud

I've been a little disappointed in myself. I'd intended this blog to be a lot more active than it has been so far. I was thinking to myself, "I just haven't had any ideas or thoughts or updates worth posting," which isn't entirely true.

I've been devoting as much brainpower as I can muster to working on the Arduino coding for the 5x5 box. I think I've worked out ways around most of my problems, which are numerous:
  • One problem I've been trying to work out is how to get the system to assign a random number value from 1-5 to each of the buttons as an indicator of a correct press. That is to say, how do I tell the system that I want it to track the order the buttons are pressed and that I want it to determine if that order is correct and that I want that order to be different each time the game is played. I think I've worked my way around this problem. I can't decide if posting a block of Arduino code here is at all interesting to anyone, especially pulled from the larger block of code, thereby losing some context. Basically, what I decided to do was to have the code generate a random number from 1-5 for each variable that I am referring to as "random1-5". Then I've told the code to check that each "random" variable was unique to itself, not having a matching number assigned to another "random". If at least two of the "random"s match, I've told the system to try again. This could work really well or it could have the little microprocessor generating random numbers until it becomes self-aware and really pissed off at my messy coding. I think that what I really need to do is to have it generate a random value for the first "random", generate a random value for the second "random", compare the two and, if they match, have the system try again before moving on. That way it is not asked to generate a whole set of random values that don't match each other by sheer dumb luck.
  • Another problem I'm having is being completely unable to test any of my code on my actual Arduino or any kind of a breadboard rigged prototype. I hate waiting for parts in the mail. Honestly, I have just about all of the parts I need to rig this all up (not the parts I'd want to use in the final product but they'll work) except the USB cable I need to upload the Arduino code to the Arduino board. Frustrating. Note to future self: Seeedstudio is in China. Ordering parts from China takes a long time. I'm itching to post a parts list but I haven't even ordered all of the parts! I'd better get moving on that.
Really, not having the USB cable is my main problem because it keeps me from identifying defects in the system, be they soft or hardware related. I won't know until I tinker and I can't tinker effectively until I get that cable. With my luck lately, it will be delivered and left on my porch and immediately stolen by neighborhood kids (or adults or a kleptomaniac squirrel or a tiny black hole or something). I bet it's something I can by from the Radio Shack down the street and all my waiting for a $2.50 cable is probably not worth my time.