Improving Registry handler and example sketch.

1. Adding support for printout to iostream.
2. Additional support macros for common variables.
3. Cleaning up example sketch.