C# Minimal Source Code to read Button A

Mar 16, 2010 at 10:31 PM

Hi to all,

after reading docs, posts and samples, I'm not able to read (for example) when Button A is pushed or not.

I'm able to turn on/off leds and rumble in few rows like the following

using WiimoteLib;
namespace SLWiimote {
    public partial class MainForm : Form {
        Wiimote wm = new Wiimote();
        public MainForm() {
            InitializeComponent(); }
         void ChkRumbleCheckedChanged(object sender, EventArgs e) {
            wm.Connect();
            wm.SetRumble(chkRumble.Checked);
            wm.SetLEDs(chkRumble.Checked,chkRumble.Checked,chkRumble.Checked,chkRumble.Checked); } } }

Is it possible to do the same to read Button A (or any other values) ?

Thanks.

 

Junta Kohime

Coordinator
Mar 18, 2010 at 10:39 PM
You can either poll the wm.WiimoteState object for the button status, or you can hook up the WiimoteChanged event and be notified regularly when updates occur.