Graphing Accelerometer Data in Windows 7: Sample Code
Microsoft includes native support for sensors in Windows 7. This support is found in the Windows Sensor and Location platform. This platform provides a standard way to integrate sensor and location devices into Windows, as well as a standard programming interface for applications to take advantage of these devices.
As sensor vendors adopt this platform, and, as they create compatible sensors and sensor drivers, application developers can use the platform to write simple applications that retrieve and respond to data from those sensors. Previously, a developer would need to build the hardware, write a driver, and then write their application code as well. And, there was no mechanism or API for exposing that hardware to other applications.
To help show the simplicity and power of the Sensor API, Microsoft has created a sample MSChartAccelerometer application that graphs data in real time from a 2-axis accelerometer. This sample is intended for developers, engineers, and others interested in collecting and displaying real-time sensor data in Windows 7.
To download the application source code and accompanying white paper:
- Go to Graphing Accelerometer Data in Windows 7 in the MSDN Code Gallery.
- Click on the Downloads tab.
The white paper describes how you can build an accelerometer device, build a Sensor driver, and build the sample application. The application is written in C# and consists of only 100 lines of code.
The hardware is based on the Parallax BASIC Stamp 2 microcontroller and the Memsic 2-axis accelerometer. For more information about both, refer to the Parallax Web site at https://www.parallax.com .
This sample uses firmware and a sample driver provided by Microsoft. To download both the firmware and sample driver source code, see Using Windows 7 to Monitor a Motion Sensor on the MSDN Code Gallery.