Monday, December 10, 2012

Netduino Serial Demo Sample

Last month we ran out of time in our meeting before I could finish up my serial data demo.  At that time I promised to get some sample code out there…all I can say is I’ve been very busy and better late than never.

The demo program I created which was called SerialIODemo is a very simple mechanism to send commands and arguments from the desktop down to the Netduino via a via a FTDI USB Serial port.

Connecting the two is very simple, just run wires as follows

BLACK  FTDI->GND to Netduino GND
GREEN FTDI->TXD to Netduino 0 (On the Digital I/O bank)
YELLOW  FTDI->RXD to Neduino 1 (On the Digital I/O bank)

Then of course you’ll need to connect both of these to your computer via USB.  The following picture should give you a good idea of how this should look.  Note the green wire is in the pin closes to end of the connector.

image

Fully Connected

image

Connection to FTDI

image

image

Connections on Netduino

After you have made your connections and plugged in the USB connections to your computer, you’ll need to check the Serial Port the FTDI is connected to. this can be done via the Device Manager under ports.  In my case, I’m on COM1

image

You’ll need to modify the code to connect to this port (TODO: Could have this configurable through the UI).  This needs to be done in MainWindows.xaml.cs in the DesktopApp project

image

Once you’ve done this you should be ready to go!

To use the app, simply make sure both programs start.  This can easily be done by right mouse clicking on the solution node SerialIODemo and setting both projects to startup.

image

Now start your program, give the Netduino a few seconds to warm up and press Connect.  When you do so, the Netduino should respond back as in the screen below.  If you don’t see this give the Netduino a little longer to start.

image

Extending the App

The idea behind this application is to invoke different commands by sending a string from the computer to the device.  The string will be in the format “command=arg”.  A switch statement in the device code will handle different commands and the args can be used to make those commands work with different “stuff” on the device.

image

image

image

Hope this gets you started on controlling your Netduino with your computer!

-twb

3 comments:

  1. This makes it different from normal board video games, which are performed on tables. However, the identical guidelines apply to each real-life and virtual versions of the identical table game. For instance, a video model of American Roulette will play out precisely like the true factor. Keep in mind that in terms of|in relation to} sportsbooks, the very fact fact} that|although} they still may supply on line casino video games, the standard is not often as 카지노사이트 much as} par with the precise casinos. If you chooseto play actual money gamesat a web-based on line casino, you’ll need to sign up for|to join|to enroll in} an account. From there, you’ll be ableto make depositsvia your most well-liked banking methodology, and defend your account from online fraud by offering the net on line casino with proof of your id.

    ReplyDelete