Unless you know the structure of the Marlin firmware pretty well, are good at coding (in C/C++), and are familiar with programming microcontrollers, then I wouldn't attempt to do this, IMHO. Adding new features can cause a number of issues elsewhere in the code and need rigourous planning and testing as well as discussion with the Marlin community.
You could however make a request (i.e. raise an issue) to the Marlin community on Github, however, I would seriously suggest posting to the Marlin forum, on RepRap, first, as random suggestions and issues raised on Github aren't really appreciated, without checking on the forum first...
If you really want to get into coding, then I would suggest buying an Arduino Uno and some components and messing about with those first, as well as visiting our excellent Arduino Q&A site on StackExchange as well as the Arduino forums.