Click here to Skip to main content
15,895,833 members
Articles / Programming Languages / C++

Writing a Sensor Driver for the Wiimote on Windows 7

Rate me:
Please Sign up or sign in to vote.
4.93/5 (61 votes)
16 Feb 2010CPOL30 min read 276.4K   16.7K   106  
How to write a Sensor driver that provides access to the 3-axis accelerometer on a Nintendo Wiimote on Windows 7
namespace Wiidiag
{
    partial class MainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.cmbMotionSensors = new System.Windows.Forms.ComboBox();
            this.label2 = new System.Windows.Forms.Label();
            this.lblSensorState = new System.Windows.Forms.Label();
            this.shapeContainer1 = new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
            this.lineShape1 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.panelHistory = new System.Windows.Forms.Panel();
            this.historyGraphZ = new Wiidiag.HistoryGraph();
            this.historyGraphY = new Wiidiag.HistoryGraph();
            this.historyGraphX = new Wiidiag.HistoryGraph();
            this.panelHistory.SuspendLayout();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(3, 6);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(95, 15);
            this.label1.TabIndex = 0;
            this.label1.Text = "Motion Sensors:";
            // 
            // cmbMotionSensors
            // 
            this.cmbMotionSensors.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.cmbMotionSensors.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbMotionSensors.FormattingEnabled = true;
            this.cmbMotionSensors.Location = new System.Drawing.Point(107, 6);
            this.cmbMotionSensors.Name = "cmbMotionSensors";
            this.cmbMotionSensors.Size = new System.Drawing.Size(509, 23);
            this.cmbMotionSensors.TabIndex = 1;
            this.cmbMotionSensors.SelectedIndexChanged += new System.EventHandler(this.cmbMotionSensors_SelectedIndexChanged);
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(21, 34);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(77, 15);
            this.label2.TabIndex = 2;
            this.label2.Text = "Sensor State:";
            // 
            // lblSensorState
            // 
            this.lblSensorState.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.lblSensorState.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.lblSensorState.Location = new System.Drawing.Point(107, 34);
            this.lblSensorState.Name = "lblSensorState";
            this.lblSensorState.Size = new System.Drawing.Size(421, 18);
            this.lblSensorState.TabIndex = 3;
            // 
            // shapeContainer1
            // 
            this.shapeContainer1.Location = new System.Drawing.Point(0, 0);
            this.shapeContainer1.Margin = new System.Windows.Forms.Padding(0);
            this.shapeContainer1.Name = "shapeContainer1";
            this.shapeContainer1.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[] {
            this.lineShape1});
            this.shapeContainer1.Size = new System.Drawing.Size(631, 374);
            this.shapeContainer1.TabIndex = 4;
            this.shapeContainer1.TabStop = false;
            // 
            // lineShape1
            // 
            this.lineShape1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.lineShape1.BorderColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.lineShape1.Name = "lineShape1";
            this.lineShape1.X1 = 11;
            this.lineShape1.X2 = 617;
            this.lineShape1.Y1 = 70;
            this.lineShape1.Y2 = 70;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(9, 87);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(114, 15);
            this.label3.TabIndex = 5;
            this.label3.Text = "X Axis Acceleration:";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(8, 178);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(113, 15);
            this.label4.TabIndex = 5;
            this.label4.Text = "Y Axis Acceleration:";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(9, 266);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(113, 15);
            this.label5.TabIndex = 5;
            this.label5.Text = "Z Axis Acceleration:";
            // 
            // panelHistory
            // 
            this.panelHistory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.panelHistory.Controls.Add(this.historyGraphZ);
            this.panelHistory.Controls.Add(this.historyGraphY);
            this.panelHistory.Controls.Add(this.historyGraphX);
            this.panelHistory.Location = new System.Drawing.Point(128, 87);
            this.panelHistory.Name = "panelHistory";
            this.panelHistory.Size = new System.Drawing.Size(488, 275);
            this.panelHistory.TabIndex = 6;
            // 
            // historyGraphZ
            // 
            this.historyGraphZ.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.historyGraphZ.BackColor = System.Drawing.Color.Black;
            this.historyGraphZ.GridColor = System.Drawing.Color.Green;
            this.historyGraphZ.Location = new System.Drawing.Point(4, 179);
            this.historyGraphZ.Name = "historyGraphZ";
            this.historyGraphZ.RenderMode = Wiidiag.GraphRenderMode.Fill;
            this.historyGraphZ.Size = new System.Drawing.Size(481, 83);
            this.historyGraphZ.TabIndex = 0;
            this.historyGraphZ.UpdateFrequency = 1;
            // 
            // historyGraphY
            // 
            this.historyGraphY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.historyGraphY.BackColor = System.Drawing.Color.Black;
            this.historyGraphY.GridColor = System.Drawing.Color.Green;
            this.historyGraphY.Location = new System.Drawing.Point(4, 91);
            this.historyGraphY.Name = "historyGraphY";
            this.historyGraphY.RenderMode = Wiidiag.GraphRenderMode.Fill;
            this.historyGraphY.Size = new System.Drawing.Size(481, 83);
            this.historyGraphY.TabIndex = 0;
            this.historyGraphY.UpdateFrequency = 1;
            // 
            // historyGraphX
            // 
            this.historyGraphX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.historyGraphX.BackColor = System.Drawing.Color.Black;
            this.historyGraphX.GridColor = System.Drawing.Color.Green;
            this.historyGraphX.Location = new System.Drawing.Point(4, 3);
            this.historyGraphX.Name = "historyGraphX";
            this.historyGraphX.RenderMode = Wiidiag.GraphRenderMode.Fill;
            this.historyGraphX.Size = new System.Drawing.Size(481, 83);
            this.historyGraphX.TabIndex = 0;
            this.historyGraphX.UpdateFrequency = 1;
            // 
            // MainForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(631, 374);
            this.Controls.Add(this.panelHistory);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.lblSensorState);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.cmbMotionSensors);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.shapeContainer1);
            this.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.MaximizeBox = false;
            this.MaximumSize = new System.Drawing.Size(647, 412);
            this.MinimumSize = new System.Drawing.Size(647, 412);
            this.Name = "MainForm";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.Text = "Wiimote Sensor Diagnostics";
            this.panelHistory.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.ComboBox cmbMotionSensors;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label lblSensorState;
        private Microsoft.VisualBasic.PowerPacks.ShapeContainer shapeContainer1;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape1;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Panel panelHistory;
        private HistoryGraph historyGraphX;
        private HistoryGraph historyGraphY;
        private HistoryGraph historyGraphZ;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Microsoft
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions