This week we stayed away from the shop. We were asked to write an application that interfaces with an input/output that we made. I wanted to use the opportunity to do something for my final project, so I thought I could write an app that controls a servo.
With zero experience writing GUIs or Apps, I looked what people did over previous years. I watched a couple of good video-tutorials of how using Arduino + Processing, so I decided to give it a chance. I started with this basic LED control tutorial. For this, I used the RGB LED board that I made a few weeks ago.
The lenguage is super easy (very similar to Arduino IDE). I include my code at the bottom of the page, but I recommend to watch the tutorial.The program basically consists of a window with three buttons (red, green and blue). When you press one of them, the app sends a character (i.e. "r", "g", "b") via Serial. Once the ATtiny reads the character, it lights up the appropriate LED (this was previosly programmed using Arduino IDE).
Here is a short video:
I thought that a quick modification of the LED app can be used to control a servo (e.g. asking it to move to 0, 45, or 90 degrees). Another option for the GUI could be a wheel that you can spin in order to specify a target position for the servo. A third option, would be to design a virtual whack-a-mole: the app would display the location of the mole-holes, then the user can select which one will raise up. This way, I could play interactively with the cat.
After some thinking, I decided to try the third option. But I'll wait until I the Networking week. I want to build different boards to control each mole (stations). These stations will communicate with master board, which would be the link to the computer. I'll also try to add bluetooth or some other radio.
Stay tuned for more! (soon)
...
Maybe I can ask the app to show the sonar readings, then I'd know how far the cat is from each mole and I could play remotely (i.e. different room).