Now that I can get the data from the Accelerometer, it would be nice to do something with the data. This project demonstrates how to use the serial data from the Teensy 3.1 Accelerometer project to update objects on a screen in a simple C# WPF (Windows Presentation Foundation) application. The data received from the accelerometer is used to change the size of lines mapped to the X, Y, and Z axis values of the accelerometer.
1. Complete the steps described to hook and program the Teensy 3.1 Accelerometer
3. Get the WPF application code. Download the repository as a zip file and extract it.
Set the COM Port and Build4. Navigate to the ADXL335SerialApp directory and open the ADXL335SerialApp.sln solution file with Visual Studio.
5. Open the Window1.xaml.cs file and change the COMPORT to the one used by the Teensy accelerometer.
6. Save the file and build the solution. Make sure there are no compile errors in the build Output window. If the build succeeded, an executable file named "ADXL335SerialTest.exe" will be created in sub directory (usually ADXL335SerialApp/ bin/Release or bin/Debug). The exact file location of the executable can be found in the build "Output" window.
Run the Application8. Double click on the executable file to run the application. A window with the following screen should appear. The white text box area is where exception messages will appear if they occur.
9. Now make sure the Teensy accelerometer USB is plugged in.
10. Press the "Start" button on the screen to start controlling the X, Y, Z axis lines with the Teensy Accelerometer.
If the accelerometer is sitting on a flat surface, only the blue line representing the Z axis will be visible as shown below.
12. Press the Stop button to stop listening to the serial port when your done.