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?

1 comment:

  1. next you can made pump system, main menu 4 pump sub menu pump 1,2,3,4 setting, time x how long pump 1 run, then main menu and menu "run pump" all 4 pump different time setting and run menu 1pump or all pump run.
    setting whit keybad, 1-100 number can bush keybad number X = time X. need only adding setting number and code know what time pump run, i no understand code good but want learn how thats made. you can make example i no know how write code thats.

    ReplyDelete