I'd love to start writting managed code for external devices and sensors. Are there any devices that come to mind that can be coded a开发者_StackOverflow社区gainst using .NET? Any suggestions?
Edit: The main thing I'm trying to do is learn how device programming works. No better way to do that in my opinion than to try to do something fun and cool.
Lego Mindstorms NXT
- http://mindstorms.lego.com/
- http://en.wikipedia.org/wiki/Lego_Mindstorms_NXT
- http://nxtnet.codeplex.com/
The Netduino just came out, and it uses the .NET Micro Framework: --> http://www.netduino.com/
Microsoft Robotics
Coding4Fun: Blog & Developer Kit
TinyCLR produces several different boards that support the .Net Micro Framework, the most popular being the Fez Domino:
FEZ (Freakin' Easy!) is a tiny open-source board running Microsoft .NET Micro Framework. This means, you can write code with much more efficiency using C# programming language under free Microsoft Visual C# express. Build your next projects in minutes by connecting FEZ Domino to one of the shields or the many available components. Includes USB cable.
Many libraries are already included like FAT file system, threading, USB Client, USB Host, UART, SPI, I2C, GPIO, PWM, ADC, DAC and many more.
FEZ offers many features not found in Arduino, BASIC STAMP and others:
- Based on Microsoft''s .NET Micro Framework.
- Runs on 72Mhz NXP ARM processors.
- Supports runtime debugging (breakpoints, variable inspection, stepping, etc.)
- Use Visual C# 2010 Express Edition for development.
- Advanced capabilities like FAT, USB device and USB host.
- Easily upgrades to hardware such as EMX.
- Open source hardware design files.
- Use existing shields and holder boards.
- Based on the USBizi chipset (ideal for commercial use).
- FEZ Mini is BS2 pin-out compatible with extra I/Os.
- FEZ Domino is Arduino pin-out compatible with extra I/Os.
USB Missile Launcher
Two products that make it super easy to interface with external devices are Phidgets and the Serializer. Phidgets come with an easy .NET API and includes a variety of hardware and software sensors and controllers. For a lot of cool Phidgets projects, and .NET hardware projects in general, check out the Coding4Fun Blog.
The Serializer, on the other hand, is geared toward robotics but also comes with a great .NET API. For a demonstration of the Serializer, there is a great article in Robot Magazine Issue 19 by Clint Rutkas (one of the people in charge of Coding4Fun).
TinyCLR, on the other hand, provides three different devices in their FEZ (Freakin' Easy) series that can be programmed using the .NET framework and run independent of a PC to interface with sensors and devices.
You should look at the Arduino or some variant - it can interface with the USB port, and the controller itself is programmed in a C-style language.
You can then interface with (basically) any sensor/device/tool you want, and you can write code in any language that can interface with the USB.
There are lots of Home Automation APIs for .Net.
The Microsoft .NET Micro Framework --> http://www.microsoft.com/netmf/default.mspx
I had a lot of fun programming with the OCZ NIA. It is essentially EEG that allows you to use biofeedback in your software. I wrote some code that translates your alpha and beta brainwaves into MIDI and DMX for synthesizer and lighting control. The possibilities though are endless.
It uses USB HID which many devices use, so it was a good introduction. There is a handful of code over at http://code.google.com/p/nia-brew/, and you'll find the OCZ NIA forums very helpful in getting started.
The list will be huge, I don't see any reason why a device could not be controlled by .NET. In a last resort solution using DllImport and direct IoControl calls to the device drivers will (assumed you know the interfaces) work well.
Tinkerforge
I didn't try this yet, but I'd like to do some more hardware programming and I'm thinking about using Tinkerforge.
Short introduction from the Wikipedia page (emphasis by me):
Tinkerforge is a platform of stackable microcontroller building blocks (Bricks) that can control different modules (Bricklets). The primary communication interface of the building blocks can be extended using Master Extensions. The hardware can be controlled by external programs written in C, C++, C#, Object Pascal, Java, PHP, Python, Ruby and VB.NET over a USB or Wifi connection, and running on Windows, Linux and Mac OS X. This non-embedded programming approach eliminates the typical requirements and limitations (development tools, limited availability of RAM and processing power) of conventional embedded software development (cfr Arduino). Tinkerforge hardware and software are both Open Source, and all files are hosted on GitHub.
As far as I understand, this is more high-level than, let's say, the Arduino.
I can probably learn more about actual hardware programming from using Arduino, but I don't want/need deep knowledge about low-level hardware programming - I just want to create something cool with hardware.
There is already another answer mentioning an USB Missile Launcher...however, the code linked there is over six years old and I couldn't get it to work with my model.
So I wrote my own library (in .NET 4.0): MissileSharp
For anyone interested, the complete source code is here.
This was my first try ever to write code for a hardware device.
For learning purposes, I looked at the code of the project linked in the other answer, and at the code of the "official" control software that you can download from the vendor's site (direct link - the source code is not directly available, but the software is written in .NET, so you can look at the code with Reflector, ILSpy or a similar tool).
I used HidLibrary to send the actual commands to the device.
Arduino is one of the better ones out there I think.
I know you said .Net, but the Arduino is a fun device to play around with. http://www.arduino.cc/
精彩评论