Skip navigation
2012

This tutorial shows how to get started with the Arduino debug tools from Visual Micro.

 

 

The debug tool is integrated into Microsoft Visual Studio Professional and Atmel Studio development systems which also provide 100% compatible Arduino programming, compile and upload.

 

Programming with a debugger has long been considered an important tool for every software developer. Arduino does not normally provide debug facilities, so this tool is, in some ways, breaking new ground.

 

In this video we demonstrate how to add breakpoints that allow us to inspect expressions while an Arduino is running.

 

This video tutorial also demonstrates how to add conditions to breakpoints. Conditions are very useful when looking for exceptions to the "norm".

 

The tutorial also shows how to switch between normal Arduino compilation and debug compilation, how to compile and how to upload to any Arduino board.

 

The Arduino plugin for Visual Studio is free, the debug tool, which is in final beta, will be an optional low cost upgrade but is currently available for free to anyone who wants to try it. We expect this offer to end in December 2012. To obtain a free copy of the debug tool simply join the Visual Micro Forum and request to join the debug beta team. We currently have about 100 beta testers of various experience levels, the more the better!

 

The debug tools work with usb/serial which includes xbee.

Lupo

ARDUINO WEATHER STATION

Posted by Lupo Sep 20, 2012

Nowadays everything is connected to Internet and everybody has its own laptop, desktop, tablet, smartphone always connected. We are used to receive data and information from the WEB but not to send something coming from our "things" to internet; now we can do that: we can have the information we need available to everybody (if we want) and everywhere. In my opinion Arduino has revolutioned the way common people approach to electronics, automation and robotics giving a real opportunity to everybody to experiment, learn and enter the amazing world of Do It Yourself. There a lot of alternatives sometimes more powerful than Arduino which can be used in DIY applications, for example one of my preferred: MBED. It is possible to realize a simple weather station which is reacheable trough the web (https://cosm.com/feeds/37440) using Arduino or MBED or other alternatives, an internet connection, a WI-FI shield (e.g. http://www.open-electronics.org/arduino-wifi-shield/) and Cosm (known in the past as Pachube). Next I'll show you a solution which can be used to have your own DIY weather station.

Goal:

To write a program to transfer files to/from the netduino SD card to a PC.

Background:

After moving the SD card back and forth from my PC to the netduino, I ran into a problem where the PC claimed that the SD card was locked, but the netduino had no problem writing/reading to it.  This issue, along with the fact that transferring the SD card between the netduino and a PC is a pain, prompted me to write a small program that can transfer files over the network.

Introduction:

The program consists of two parts: a server that runs on the netduino and a client that runs on the PC. The server listens for commands sent over the network and responds to the requests that it receives.  The server is capable of executing the following commands:

 

List – lists the files that are on the netduino SD card

Get – transfers a file from the netduino to the PC

Put – transfers a file from the PC to the netduino

Delete – deletes a file from the netduino SD card

Implementation:

First, in order to be a good citizen, I spawn off a new thread for the file server.  This is because socket calls can take a large amount of time and are blocking, so this leaves it open for something else to be going on.  (This program doesn’t take advantage of that, but future ones might…)  This is the same trick that was used in the netduino web server.

 

When a client makes a request, the first thing that is sent over is the type of request that they wish to perform, one of the four options listed above.  After that a string is sent.  The string is either a directory, in the case of list, or a file name in all of the other cases.  In order to send that, first the length of the string is sent, then followed by the string, so that the server knows when to stop.  The depending on the request that is made, the data is either returned – in the case of list or get, the server waits for more data – in the case of put, or the server executes the command – in the case of delete.

 

The actual transferring of data isn’t that exciting.  In a similar fashion to the way that the file name is sent over, first the size of the transfer is sent followed by the actual data.  The only tricky part was that since the netduino doesn’t have that much memory, I tried to keep the transfer sizes small.  Unfortunately, by doing this, I ran into an issue where the socket buffer is full and I’m trying to make a send call and I get a socket error #10055 (WSAENOBUFS).  The workaround to the problem is to issue a sleep after sending a small amount of data and giving the netduino a chance to clear out its buffer.  This seemed to work very well, but it slows down the transfer of the file.  I also tried sending larger chunks of data, but I had much better luck with adding a sleep.

 

The client code is a mirror of the server code, so there isn’t really anything new in there.  If you have any questions, check out the attached code or ask a question in the comments.

Summary:

In this post, I described a simple netduino file server that can be used to quickly and seamlessly transfer data between the netduino and a PC over Ethernet.  This means that you don’t have to remove the SD card every time you want to transfer data back and forth.  This also opens up the possibility to use the netduino a network file store to transfer files back and forth between home and work.  However, if you are going to do that, you should probably put some kind of authentication so that a third party can’t steal or delete your data.  (Potential future project!)

See Also:

Netduino Web Server

Netduino Tic Tac Toe

Filter Blog

By date: By tag: