Index: code/branches/wiimote/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/wiimote/src/libraries/core/CMakeLists.txt	(revision 9789)
+++ code/branches/wiimote/src/libraries/core/CMakeLists.txt	(revision 9790)
@@ -99,4 +99,6 @@
     cpptcl_orxonox
     ois_orxonox
+    wiic_orxonox
+    wiicpp_orxonox
     tinyxml_orxonox
     util
Index: code/branches/wiimote/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/InputManager.cc	(revision 9789)
+++ code/branches/wiimote/src/libraries/core/input/InputManager.cc	(revision 9790)
@@ -60,4 +60,5 @@
 #include "WiiMote.h"
 
+
 namespace orxonox
 {
@@ -217,20 +218,52 @@
         this->loadMouse();
         this->loadJoySticks();
-
+        this->loadWiiMote();
         // Reorder states in case some joy sticks were added/removed
         this->updateActiveStates();
-        this->loadWiiMote();
+
         orxout(verbose, context::input) << "Input devices loaded." << endl;
     }
+
     void InputManager::loadWiiMote()
     {
-    	try
+
+    	CWii wii; // Defaults to 4 remotes
+    	std::vector< ::CWiimote>::iterator i;
+    	int reloadWiimotes = 0;
+    	int index;
+
+    	// Find and connect to the wiimotes
+    	std::vector<CWiimote>& wiimotes = wii.FindAndConnect();
+    	if (!wiimotes.size())
     	{
-    		devices_.push_back(new WiiMote(234));
+    		cout << "No wiimotes found." << endl;
+   		}
+
+   	    // Setup the wiimotes
+   	    for(index = 0, i = wiimotes.begin(); i != wiimotes.end(); ++i, ++index)
+   	    {
+   	    	// Use a reference to make working with the iterator handy.
+    	    CWiimote & wiimote = *i;
+
+    	    //Set Leds
+    	    int LED_MAP[4] =
+    	      {CWiimote::LED_1, CWiimote::LED_2,
+    	       CWiimote::LED_3, CWiimote::LED_4};
+    	    wiimote.SetLEDs(LED_MAP[index]);
+
+
     	}
-    	catch(std::exception& e)  //gotta catch em all
-    	{
-    		orxout()<<"Exception loading WiiMote!!!1!11!";
-    	}
+   	    try
+   	    {
+   	    	orxout()<<devices_.size();
+   	  	    devices_.push_back(new WiiMote(devices_.size(), *(new CWiimote())));
+   	    	//devices_[2] = new WiiMote(devices_.size(), *(new CWiimote()));
+
+   	    }
+   	    catch(std::exception& e)  //gotta catch em all
+   	    {
+   	   	      orxout()<<"Exception loading WiiMote!!!1!11!";
+   	    }
+
     }
     //! Creates a new orxonox::Mouse
@@ -436,6 +469,11 @@
             for (std::map<int, InputState*>::reverse_iterator rit = activeStates_.rbegin(); rit != activeStates_.rend(); ++rit)
             {
-                if (rit->second->isInputDeviceEnabled(i) && (!occupied || rit->second->bAlwaysGetsInput_))
+            	orxout() << "Checking ID " << i <<std::endl;
+            	orxout() << "Checking condition 1: " << rit->second->isInputDeviceEnabled(i) <<std::endl;
+            	orxout() << "Checking condition 2: " << rit->second->bAlwaysGetsInput_ <<std::endl;
+            	orxout() << "Checking condition 3: " << !occupied <<std::endl;
+            	if (rit->second->isInputDeviceEnabled(i) && (!occupied || rit->second->bAlwaysGetsInput_))
                 {
+                	orxout() << "Success with ID " << i <<std::endl;
                     states.push_back(rit->second);
                     if (!rit->second->bTransparent_)
Index: code/branches/wiimote/src/libraries/core/input/InputState.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/InputState.cc	(revision 9789)
+++ code/branches/wiimote/src/libraries/core/input/InputState.cc	(revision 9790)
@@ -55,5 +55,7 @@
     {
         if (device < handlers_.size())
+        {	orxout() << "Test we made it into the if clause" << std::endl;
             return handlers_[device] != NULL;
+        }
         else
             return false;
Index: code/branches/wiimote/src/libraries/core/input/WiiMote.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/WiiMote.cc	(revision 9789)
+++ code/branches/wiimote/src/libraries/core/input/WiiMote.cc	(revision 9790)
@@ -10,6 +10,5 @@
 	void WiiMote::update(const Clock& time)
 	{
-		orxout()<<"fegit\n";
-
+		orxout(user_warning) << this->inputStates_.size() << std::endl;
 	}
 	void WiiMote::clearBuffers()
@@ -21,6 +20,7 @@
 
 	}
-	WiiMote::WiiMote(unsigned int id)  : InputDevice(id)
+	WiiMote::WiiMote(unsigned int id, CWiimote & parent)  : InputDevice(id)
 	{
+		p = &parent;
 	}
 }
Index: code/branches/wiimote/src/libraries/core/input/WiiMote.h
===================================================================
--- code/branches/wiimote/src/libraries/core/input/WiiMote.h	(revision 9789)
+++ code/branches/wiimote/src/libraries/core/input/WiiMote.h	(revision 9790)
@@ -1,6 +1,7 @@
 
 #include "InputDevice.h"
-//#include "InputState.h"
 //#include "InputManager.h"
+
+#include <wiicpp/wiicpp/wiicpp.h>
 
 
@@ -8,9 +9,14 @@
 namespace orxonox
 {
+
+
+
+
 	class WiiMote : public InputDevice
 	{
+
 	 public:
 			//! Only resets the members
-        	WiiMote(unsigned int id);
+        	WiiMote(unsigned int id, CWiimote & parent);
         	~WiiMote() { }
 	        //! Returns the device class (derived) name as string
@@ -26,7 +32,9 @@
 	         //! List of all input states that receive events from this device
 	         std::vector<InputState*> inputStates_;
+
 	 private:
 	         static const std::string deviceName;
 	         void test(int x, int y);
+	         CWiimote * p;
 	};
 };
