My good friend Alexandros Sigaras has a very interesting hobby, robotics. He has presented in numerous events about Robotics using Lego Mindstorms NXT (check a video of him presenting here). After my blog post on Controlling a Missile Launcher with Windows Phone 7, we had a nice idea; create a Windows Phone 7 application to control his R2D2 robot. Since the Windows Phone 7 has not yet a Bluetooth API, we had to use a desktop application as a proxy.
(R2D2 image from wikipedia article)
Alexandros build a WPF (Windows Presentation Foundation) desktop application to control the robot. This was made pretty easily by using the MindSqualls library, an open source library that can connect and send special instructions to the NXT. I then coded a WCF service in the same app (pretty much like the one I did for the missile launcher app) and the respective Windows Phone 7 application, that consumes the web services exposed by the WPF app. These web services control 5 robot functions
- Move forward
- Move backward
- Rotate left
- Rotate right
- Stop
These functions are coded in the WPF app, and basically order the robot motors to move accordingly.
Check the video
[youtube:l_vjQJW3pkA]You can download the source code for everything here on my skydrive: http://cid-10e568adbb498dc8.office.live.com/self.aspx/Windows%20Phone%20Source%20Code/NXT%5E_Robot%5E_R2D2/NXT.zip