To simplify getting the data from a WiiMote device into an SWDataNetwork, a method has been created which automatically sets actions for the WiiMote device to set the data into a DataNode in the network. It also copies the labels, prefixed with 'wii_', that have been set for the WiiMote over to the data slots.
WiiMote.start; // start the eventloop WiiMote.discover; // discover a new device (wait for post about connected) w = WiiMote.all[0]; w.enableMotionSensor( 1 ); w.enableExpansion( 1 ); w.enableButtons( 1 ); x = SWDataNetwork.new; // add just wiimote x.addExpected( 1 ); w.addToNetwork( x, 1 ); x.makeGui; // add both wiimote and extension: x.addExpected( 1 ); x.addExpected( 2 ); w.addToNetwork( x, 1, 2 ); x.makeGui; w.setLEDState( 0,1 ); // LEDs are reflected as data as well w.setLEDState( 0,0 ); // LEDs are reflected as data as well w.close;