C# Winform

Hi,

Does anyone have any examples of how I can use a C# Winform to interact with the Fez Spider? I would like to be able to switch on a relay switch for example via a button on the form and also get back temperature readings into a textbox?

Any pointers?

thanks again!

@ thenecroscope - there are a number of options, all of which are essentially a means of communicating messages back and forth between the pc and your spider. Here are a few that I can think of off the top of my head, you should be able to find reference code for most if not all on the code share.

  1. TCP/IP
  2. Serial comms
  3. Bluetooth
  4. Web server on spider
  5. USB
  6. DPWS (web services)
    Etc.

Personally I like option 4, it is relatively easy to implement and is standards based so you could easily support other clients, think REST. Option 5 will require that you setup serial debugging, but has the advantage that the production system will just be a USB device if that is what you require and does not need to be on the network.

I’ve just finished something similar and hope to get something posted in the next few days. I used the FEX Cerbuino and the Roving xBee WiFi module (https://www.sparkfun.com/products/10822). I think it could also be done using the xBee module from GHI and the Roving but I haven’t looked at that as a solution. Take a look at http://www.tinyclr.com/forum/topic?id=8680 for some discussions of sockets (albeit using Win8) as a great place to start.

I can’t give you a specific example but Winform is just a UI so if you can find C# code to do this all you’ll have to do is put it in the button object’s click handler (or, if you’re into well architected code, a class method called by the click handler).

Do note though that Winform doesn’t really have data binding in the same way as WPF/Silverlight/etc. so for populating the text box you’ll probably have to do it manually. Probably want a timer in the form to periodically poll the device and update the form.

WinForms are not supported under the Micro Framework version of .NET. MS provides a sub-set of WPF for GUI development.

GHI provides a free library called Glide, which is a better choice, in my opinion, than WPF.

There is also Clix and TinkR, two GUI libraries from Skewworks, which are available for reasonable fees.