Nov 7, 2012

Modules updated

Re-designing the code


Finally I've got some time to update the files to github. The after having a break for a couple of months I realized that my first approach was wrong, the classes were dependent, therefore I redesigned each of the for having independence among them.

Some tests need to are bounded to several classes, e.g. the most of the class need the class LCD to show the behavior or result of the tests.

When I re-designed the classes I had also to rename some of them. At the time of updating this to github I encountered with a problem. I had removed or rename the files on my local computer so when I did commit and push them to the server, the server kept the old files and the new. There was no way to remove them. Was then when I found the following command that helped me to remove the old files from the server, and update everything as it was on my local computer:

git add . -A
git commit -m "removed some files"
git push origin master

This is the list of new classes:


DHT11
Sensor of temperature and humidity. I took the code from http://arduino.cc/playground/Main/DHT11Lib in which I did some minor changes.

Keypad
Now this class only controls the keypad and does not include the LCD, Even though are both in the same board. I believe this way is more clear for use it, and the code is grouped by functionality and cleaner.

LCD
This class only writes on the display, nothing else. Actually is the wrapping of the LiquidCrystal class where I merged a couple of function to make the writing easier.

LEDRGB
This class remains almost the same, what before was test now is function of the class. So the test only calls the functions.

MenuController
This class controls the index of the menu but is not a menu itself. does not contain titles/text. That will be performed by the class Menu in the future.

Relay4
Represents the board Channel Relays. It offers the basic functions for controlling the relays.

Test samples.
Now the tests are clearer, shorter and easier to run.



What is next.



I'm thinking about a good way to generate a Menu dynamically and reusable, with a main index and each item containing options, any suggestions?

Aug 25, 2012

Interactive menu with keypad and the LCD display

After make sure that each button is recognized properly by the software I created a class called Menu.

This class is for controlling the menu's options, reacting to the buttons' events:
UP, DOWN, LEFT  and RIGHT.

Basically the menu has four options, they are listed as follow:


1 - LIGHTS
2 - WATER PUMP
3 - FAN
4 - HUMIDIFIER

The program starts showing the option 1 - LIGHTS. Pressing the buttons UP and DOWN you can scroll the menu. Boundaries were established to not let the buttons scroll more than available options.
With the LEFT and RIGHT buttons you can set ON and OFF the status of the output which is not implemented yet. The status is shown on the bottom right corner.