Educational materials

WiiLAB Example Code - Acceleration Graph

Note: MATLAB R2007a or greater is required for this code to run correctly.

Annotations

The Acceleration Graph creates a new window that contains three subplots displaying the Wiimote's acceleration values in real time. The graphs will be updated every time the acceleration values from the Wiimote are updated. These graphs can be added to any program just by initializing the graph. They are contained in a separate window and are updated automatically when the acceleration is updated.

Usage

initializeWiimoteAccelGraph();

closeWiimoteAccelGraph();

Example

The following snippet of code will initialize the Acceleration Indicator and attach it to the created circle. After the main program the indicator is closed.

initializeWiimote();
initializeWiimoteAccelGraph();

% Main Program

closeWiimoteAccelGraph();

Raw Source Code

The source code is also available as a .m file download at the bottom of the page.

%% initializeAccelGraph
function initializeWiimoteAccelGraph()
%  usage:    initializeWiimoteAccelGraph()
%  purpose:  set up a figure that can track and graph the Wiimote's 3 acceleration
%            values in real time

global wiimote;

% initialize the graph
wiimote.InitializeWiimoteAccelGraph();



%% closeAccelGraphfunction closeWiimoteAccelGraph()
%  usage:    closeWiimoteAccelGraph()
%  purpose:  signifies that the user is done plotting data on the open
%            Wiimote acceleration plot

global wiimote;

% close graph
CloseWiimoteAccelGraph(wiimote);

-- JordanBrindza - 10 Jul 2008

r5 - 21 Jul 2008 - 14:20:45 - JessicaSzweda
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Syndicate this site RSSATOM