Video for LCD VDay Project Uploaded!

I uploaded it here, and it should be available in about 30 minutes from this post.

Last night, instead of working on a new project, I figured my #1 priority is to document my code for the VDay project.  Currently I know how it works inside and out, but a year from now I won’t.  So I’m trying to document as much as I can, including the hardware, so not only will I be able to add to it later, but when I share the source, everyone else will be able to know how to modify it to achieve their results.   To do this, I have many sections like the following:


This is the utility that unlocks new things in the main menu.
It does so by first getting the password from the user. If
that password is not CODELEN long(defined in AdvMenu.h) then
it escapes, giving no feedback :P


If it is CODELEN long, then it goes through and loads each
codeword at a time, using get_secretcodes(i), It compares
the codeword that was retrieved (stored in global variable
_secretcode) with the users password submitted. If it matches
all spaces, it updates the menu, and goes into the Card.

After they leave the card, they are back in the settings menu.
Upon returning to the main menu, the new card is the first one on
the list now.


If you want to change this from calling a card, to calling something
else, you will need to change the Card call to a menu_sel call, and
create a case, which corresponds to the offset in the menu table.

To make a card a 'secret card'
1: Make sure you have loaded your secret codes into the EEPROM. You can
do this like so:
set_secretcodes((uint8_t *) "125141",0);
Where the string "125141" is the code, and 0, is its offset. This
string is stored into EEPROM character by character. So if your
string contained a 0, what would be stored is '0' (dec: 48, hex:0x30)
The offset 0 starts from SECRETCODEOFFSET and goes offset * CODELEN
up in the EEPROM, storing/reading each code.

Generally I create the random numbers in excel by the following:
Round(rand()*9.5,0)
It creates a number from 0 to 9, randomized.
1a:To check the numbers for a specific location, you can use the following
loop:
lcd->clear();
get_secretcodes(i);
for(j = 0; jprint((char)_secretcode[j]);
}
2: Check the #define constant CODETOMENUOFFSET in AdvMenu.h. This is the
number of positions down in the main menu table MenuTable your secret
cards will need to start at + 1. So if our CODETOMENUOFFSET is 20,
our first hidden card starts at 21, so if we number the menu items
sequentially starting at 1, our displayed title would be the 21's one.
3: Add the string for the name of the new item:
const prog_char PROGMEM MenuStr21[] = "new menu item";
Note: String length must be within rows of display (if you have a 2x16
LCD, this string should be less than or equal to 16 long. If arrows
are used, then it should be limited to 15 long.
4: Add the string to MenuTable:
PGM_P PROGMEM MenuTable[] = {
MenuStr21[],
Be sure the last item in the table doesn't have a comma. Also it is
nice if you add it in the same order as the menu.
6: Do NOT update MAIN_MENU_MAX, this is for the number of non hidden
items that are displayed without any special codes.
5: Follow the guide for adding a card.
That's it!

To make an App that is secret
This will repeat many of the same things as the 'To make a card a
secret card' tutorial, so I will point out the differences that
will need to be made
1. Change the Card call below, so that it calls menu_sel(lcd,value).
Since this function is in the settings folder, the _submenu is 1,
so you can create an CASE here for the app, or you could temporarily
change _submenu to 0 (main menu) before the menu_sel call, and change
it back to 1 after. If you do that, then you only need 1 function
call in main.
2. Create the case in the _submenu0 switch statement for the app offset.
3. Will still need to follow steps 2-6 for the above tutorial.
4. To create the function, create it in this file or another, like the
following:
uint8_t AdvMenu::notsure(LiquidCrystal* lcd)
{
}
Modify AdvMenu.h to include this new function in the public: functions
of the class AdvMenu like so:

uint8_t notsure(LiquidCrystal* lcd)
You can of course modify the arguments as well as the return. You will
need to include the lcd argument if you want to display to LCD.
That's it!

While that is pretty verbose, I think it is better to be overly verbose rather than under, since if you are lost trying to figure something out.  I also documented the circuit in text form, which may be helpful.  That’s it for now, enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s