Setting up the Windows 7 SDK Beta Virtual Light Sensor

by Admin May 14, 2009

In my previous, post Windows 7 Sensor and Location API I spoke at a very high level on what the Sensor and Location APIs bring into Windows 7.   Now I'd like to delve a little deeper and show how to setup the Virtual Light Sensor that comes with the Windows 7 SDK Beta.  If you don't have existing hardware sensors on you computer the Virtual Light Sensor is a good way to experiment with the APIs.   Given that one of my favorite programming languages is C#, I'd like to be able to setup a sensor and use C# and the .NET framework to interact with it. 

I can do just that using the Windows 7 Sensor and Location Interop Sample Library, which includes a simple wrapper for a few sensor and location APIs and objects.  It also includes two sample applications, a version of an MSDN reader that adjusts based on ambient light sensor information and a simple game that moves a Marble around on the screen using an accelerometer.   I first learned of this .NET sample code and the Virtual Light Sensor on the Windows Team Blog in Yochay Kiriaty's post Windows 7 Sensor and Location .NET Interop Sample Library.  In this post, I will expand on setting up the Virtual Light Sensor and testing your environment with the sample MSDN Reader mentioned in Kiriaty's post.

To start experimenting with Windows 7 Sensor and Location .NET Library you need to have a few prerequisites.

  1. .NET 3.5 SP1 
  2. Visual Studio 2008
  3. Download and install the Windows 7 Beta SDK -  This is an ISO DVD image.
  4. Download and install Microsoft XNA Game Studio 3.0 - This is only required if you want to run the Marble game demo.
  5. If you want to run the Marble game demo in the sample library, you will need a hardware accelerometer.

Once these prerequisites are installed, you can proceed to setting up the Virtual Light Sensor that comes with the Windows 7 Beta SDK.  

Step 1 - Go to Device Manager, right click your compurer name, and Select "Add legacy Hardware"

Step 2 - In the add new hardware wizard make sure you choose to manually select the driver.

Step 3 -  When prompted to select the type of hardware you are installing, select "Sensors".

 

Step 4 - When prompted to select a device driver, choose "Have Disk".

Step 6 - In the location dialog browse to C:\Program Files\Microsoft SDKs\Windows\v7.0\bin which is the location of the Virtual Light Sensor driver.

After selecting the driver location, continue thru the wizard until installation is complete.

Step 7 - Enable the sensor

Before you can use the virtual light sensor it needs to be enabled. Go to Control Panel -> Hardware and Sound -> Location and Other Sensors.  You will see a screen like that below.  Check the box to enable the sensor and click apply. 

Step 8 - Run the Virtual Light Sensor Application

Now that the sensor is enabled, open Windows Explorer and navigate to C:\Program Files\Microsoft SDKS\Windows\V7.0\Bin and run VirtualLightSensor.exe as an Administrator.  Note: In my environment running this application triggered another install of the sensor.  If that occurs, you may need to repeat Step 7 and select the newly installed sensor.

Once launched you should see the application which looks like this:

You can now use this application to adjust the current light level and the app will trigger the appropriate events and reports through the sensor API.

To see this in action navigate to the location where you un-zipped the Windows 7 Sensor and Location Interop Sample Library and open the solution file Windows7.sln.  Once this is opened, launch the MSDN reader application, and try changing the light intensity using the slider in the Virtual Light Sensor application.  You should be able to see the interface change as you change the lighting environment with the slider.

You now should have everything you need to start building your own application that uses the Virtual Ambient Light sensor.

 

 

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Search Blog

WELCOME TO OUR BLOG

Fusionovation is an industry blog written by Smooth Fusion team members that serves to inform marketers of cutting-edge digital topics and trends.

Smooth Fusion specializes in helping marketers with the planning and implementation of digital campaigns and ongoing programs. We are a trusted partner to marketing agencies and corporate marketers worldwide, delivering our unique blend (or fusion) of technical expertise and understanding of the needs of marketers.

Our team is made up of consultants, project managers, software engineers, developers, designers, and quality assurance specialists. And what we all have in common is experience using technology to empower marketers. Learn more about Smooth Fusion.