1. The SDK comes with a pre-made sample called 'RawStreams'. When you installed the SDK, a folder called 'Intel RealSense SDK Gold' should have been placed on your desktop. Within his folder is an application called 'Sample Browser', which provides an easy interface for browsing RealSense sample programs. you can find RawStreams in this application, under the 'Common' section.
In the '2016 R2' version of the RealSense SDK (which you should be using with the R200, as the '2016 R3' SDK lacks R200 support), RawStreams is available in C# and C++ formats, with accompanying source code.
2. A helpful resource for getting started on perceiving the proximity to objects may be a RealSense project that uses the R200 called the Spatial Awareness Wearable (SAW), a project by Intel employees which provides source code.