Wiimote example programs - c#

I'd like to use the Wiimote (accelerometers, gyroscopes, infrared camera, etc, etc, etc) on various applications.
It's a bluetooth device, and I know others have connected it to their computer.
What's the easiest way to start using it in my software - are there libraries for C#, for instance?
I want my software to be usable and easily installable - what's the current easiest way to connect a wiimote to the computer? Can I make that process part of my software installation?
-Adam

Have you seen Johnny Chung Lee's 'Procrastineering' Blog? He's written a lot on the subject of using wii remotes and has some fantastic demonstration videos. [Edit] I just found out Mr Lee did a TED talk which gives a good introduction to the stuff he's done too...
There's a wealth of information over on Wiibrew.org - check out their Wiimote Library page for some other APIs if you want to look beyond c#. As an avid Python fan, I'm quite curious to have a play with the pyWiimote library :-)

Coding4Fun had a managed C# library up that would allow you to interface with it but it seems their site is down right now. Though I think they used the Robotics Studio so that may be a place to start.
Found it... http://www.codeplex.com/WiimoteLib
Oh and I forgot to post a link to these videos I saw quite some time ago. http://www.cs.cmu.edu/~johnny/projects/wii/

If you use WiimoteLib (from Coding4Fun as mentioned in another answer), there is an example application called WiimoteTest. This tests all of the Wiimote inputs and outputs, including for multiple Wiimotes at the same time, so it is a good starting point for your own Wiimote code as it gives you an example of how to do pretty much anything you would want to.
For the second part of your question, connecting the Wiimote to the computer is pretty much the same as connecting any other Bluetooth device. I don't know that it would be very suitable to have this done at installation as it is likely to be connected and disconnected a lot, especially since the Wiimote will turn itself off if not used for a while. However, it's pretty much a matter of following a standard Windows wizard to connect to it, so it's not too hard. This assumes you have a Bluetooth driver that will work with the Wiimote - more information on that is available at the Coding4Fun website. It worked for me with the default driver that already came with my laptop but if it doesn't for you, the one they recommend is BlueSoleil.

what's the current easiest way to
connect a wiimote to the computer?
I not found solution for connect wiimote within my software, you have to connect manually into Windows, but on Windows register bluetooth device it very take time, Try Toshiba bluetooth stack it more convenient.

Related

Capture camera using DirectShow

I'm developping a SmartDevice application (Pocket PC 2003 template) in C# for a device with Windows Mobile 6.1. I need to use the camera of this device (photos, video); to do this work i tried using the CameraCaptureDialog class but it does not work for Pocket PC applications.
So, I documented on the internet and found that I probably refer to DirectShow API, but the problem is that I do not know where to start because I can't found a working/correct example.
My questions:
Is this the right way? Are there alternatives?
Where I can find a very good example that shows how to do this work?
You may try directshowbetcf: http://alexmogurenko.com/blog/directshownetcf/ if you really want to go with DirectShow and NetCF.
There's plenty of examples of directshow on the web. There is a site dedicated to converting the API over to C# which makes it a lot easier, maybe this was it http://directshownet.sourceforge.net/about.html. I struggled with DirectShow until I read the book "programming directshow" from microsoft press. About a third of that way through that book it all seemed incredibly easy and I was able to complete what I wanted. In the end it's a lot like referencing any library and using the classes from within that library. The added difficulty is that you need to add wrappers because they are all COM objects but that has been done for you.
This might be useful to you to understand the DirectShow technology. Basically gives a start to DirctShow and explains some of the important points. But its C++ not C#. Hope this help
Basic Video Capture
DirectShow is the video capture API in Windows Mobile 6. There is a Video Capture Filter there and all in all things are designed pretty much the same way they are in Windows.
The problem is that however that this is a native API, and not just in Windows Mobile. To develop in C# you need some bindings and they are missing. On desktop there is DirectShow.NET, which is a missing piece, but it does not seem to fit well for CE. Yet you still need to fill this gap in Windows Mobile.
To work it around you have a few ways, the first would be to go through DirectShow.NET and update it appropriately to start working on your device, strip parts missing in mobile OS etc. This would get you a twin for DS.NET but for mobile operating system.
Another option would be to do some C++ development and implement the minimal sufficient feature set in that domain, exposing the component via COM. Then you will reference this from managed code and things will get connected together. And another obvious option would be to use a third party solution which already does one of the mentioned above.

Simple way to read values from the SMBus in C#, on a Windows machine?

I've been at it for a month, and still can't find a solution to this deceptively difficult problem. Specifically, I would like to read temperatures from the W83793 chip, using C#, on a Windows machine. I have virtually no experience with low-level programming. All I know is that in order to read from this chip, I need to access the SMBus, and that alone will get me started.
Despite going through every SMBus document I could find online, I am still clueless as to how I should start. I searched for C# SMBus libraries online, but couldn't find anything aside from a few Linux related documents. I don't want to re-invent the wheel here. There's got to be a library, a tutorial, or other resource out there to explain exactly how to access the SMBus in C# on Windows.
What is a simple way to access the SMBus in C#? If you can help me out to the point where I can pull SOME value, ANY value, out of a slave device on the SMBus, that will get me started.
Look at OpenHardware monitor. It will have code dealing with that already.
Else use WinRing0, if you feel adventurous. :) You would normally access the smbus via ISA port IIRC. (I did this previously before I discovered OpenHardwareMonitor, a very fun exercise).
A helpful tool is called 'ReadWriteEverthing' for poking at all kinds of hardware ports. Expect blue screens or freezes :)
Have you looked at the Windows Driver Kit? Searching around the web, it seems like its the place to start when communicating on SMBus from within windows.

Creating a usb time lapse for Cannon EOS Rebel XS using a c# program

I am wondering if this is even possible. I want to make my own software to control the release of the shutter via the remote shutter release. From the diagrams I have seen it has a 3.3 v (no load) and a threshold voltage of 1.8v. I am wondering if I can use limit a usb cables voltage which is around 5.25v, if I am understanding correctly. Is this even possible, or do I need to look in a new direction. I am hoping to write the software in c# which I am fairly confident in.
Thank you in advance for your help :)
I've played a lot with these type of shutter remotes, for both the sony alpha and for the canon line of dslr's. For the cannon, it is usually a 2.5mm stereo plug. It has 3 contacts: ground, focus and shutter. Shorting each one of them and you will trigger that function in the camera.
http://www.doc-diy.net/photo/eos_wired_remote/
A few years ago, I designed my own circuitry that would take serial commands from the host (in my case an HP Pocket PC) and drive one of the lines down using a microcontroller GPIO port.
Nowadays there are similar devices with much easier connection and control options. And if you'd like to take the DIY road, there are very nice options such as the arduinos or if you're a c# addict, there are the netduinos.
Here's a commercially available solution, including SDK:
http://www.breezesys.com/DSLRRemotePro/features.htm
Working with USB devices in .Net is not the most straightforward task... There are no libraries in the BCL to deal with USB. However, it is possible to use Win32 API's.
This article should get you started in the right direction, as far as accessing a USB device if you want to pursue this.
As for whether it's possible, it might be... I don't rule anything out, but I think you're in for a LOT of research time to make it work if it's possible at all. (I've never seen anything in the Win32 API documentation that allows you to control the voltage, for example). However, it would be very cool if you could make it work, and the satisfaction factor alone may be worth the try.
Added
I took a look at PInvoke.net (a very good site for learning about Win32 API calls) to see if they cover power management for USB drives, and I see nothing at all.
http://www.pinvoke.net/search.aspx?search=usb&namespace=[All]#

C# Robotics / Hardware

I'm aware of Phidgets, however, I'm looking for some other types of hardware that can be interfaced with C#.
Anyone got some good ones?
Check out the Netduino. It is based on the Arduino but is programmed with the .Net Micro Framework
Take a look at my "World's Smartest House Project" http://blog.abodit.com/category/home-automation/smartest-house/ as featured on .NET Rocks #518.
It's written in C# and interfaces to X10, thermostats, alarm panels, a multi-zone audio switcher, a projector, Denon amplifiers, driveway sensors, strain gauges, and much more ...
A Caddx alarm panel is about the cheapest sensor input device you can connect to a PC - one serial port gets you 100+ inputs both wireless and wired.
Actually Lego Mindstorms kits are cheap and have a lot of different libraries to code in.
Microsoft Robotics for example. More info can be pulled from this article. My experience with Lego Mindstorms was before the NXT versions and using C however it was a great and challenging time. I may even look into grabbing a kit now that this popped up..
Advantech has a nice set of USB IO boxes that can be interfaced with anything hardware. They have a nice native .net framework with examples in C#.
The one I'm using is to control a robotic workcell I'm developing:
http://www.advantech.com/products/USB-4751/mod_1-2MLJNA.aspx
If you're specifically looking for hardware, two suggestions I've like to add are Parallax and the ROB Series. Not only can you buy whole robots you can assemble yourself (and let's face it, that's fun too!), but also bits and pieces such as microcontrollers, sensors and accessories, which you can use for your own custom-made projects.
While you will have to roll your coding sleeves before you get to actually command these bots, it's a fun process. I suggest you look into Microsoft's RDS and their DSS and CCR forums to help you get started.

Getting started with writing a desktop app that talks to an iPhone

I'm thinking of writing an app to selectively transfer photos/music to and from my iPhone, mostly for fun and personal convenience. However, I'm stuck at the very beginning -- where do I look to find information on how to do this?
Pretty much every link I see talks about developing applications that run on the iPhone, but nothing about desktop app for interfacing with an iPhone.
I'm on Windows (no access to a Mac, but I'll take suggestions for that for when I eventually acquire one), and I'm most familiar with C#, but other languages are definitely an option.
Can anybody offer me a few pointers on getting started? Thanks.
Edit: to clarify further, I don't need information on how to write applications that run ON the iphone. There are plenty of resources out for that. :) What I'm looking for it some pointers on how to "talk" to an iPhone or an iPod through the USB cord, if that's even possible.
Edit #2: I found libmobiledevice library that effectively does what I'm talking about on Linux. I don't think I'm too keen on attempting to port it over to Windows, though. :)
I found what I was looking for: SharePodLib. Thanks, everyone.
I recommend and have used the following options:
Option 1:
Run a small and light webserver in the iPhone and of course, use HTTP to transfer. I recommend mongoose websever, i've tried it with very simple and very heavy load. Also here, you can find an actual drag and drop project to deploy this webserver in the iPhone.
Option 2:
Use something like Bonjour, this is something very useful if you want the "smart" discovery of your device in the network, maybe for opportunistic peer discovery. You can check here and here, to understand how to get bonjour to run in the iPhone and use it to exploit discovery and sharing.
Hope it helps!!
Unfortunately, there's no no way to sync an iPhone app with a Mac app over USB, at least in the current SDK. As already stated, you'll have to either sync over HTTP or use the local network. You might want to check out ZSync, a Cocoa library for bonjour syncing (I haven't used it, and it's in early development stages, but it looks interesting).
Unfortunately there is no officially sanctioned method to do what you describe. In Apple's view the only application that should have visibility of that information is iTunes. There are applications out there that appear to be able to do this, but I suspect they have reverse engineered the USB protocol and are thus open to being locked out if the protocol changes.

Categories