I'd have to say that your idea is possible, although it isn't as simple as it may seem.
A common approach to involve electronics and coding is to use a microcontroller (PIC, AVR, Stamp etc.) and create a program that will code the microcontroller to perform a specific task.
If you're up on Assembly Language, then you have a HUGE start to programming microcontrollers. Nevertheless, there are compilers that you can use to program in C, Basic and probably some other languages as well.
I suppose the first start here is to read up on microcontrollers (a lot of people stick to the PIC microcontrollers by Microchip. Although, the recent trend is in AVR microcontrollers) Then build/purchase a microcontroller programmer, and obtain software as a compiler / assembler.
I'd say learning the microcontroller works and programming the controller to provide a practical output involves some study.