Anda di halaman 1dari 22

Arduino Debug Tool - Debug Over Serial, XBee, Bluetooth, IP/Net A power tools licence boosts an existing installation

of the free "Arduino for Visual Studio" plugin to provide exceptional debug and communication tools. Power tools ensures that your arduino code is clean and free of all debug and diagostics code allowing simpler project development. Debug Detailed Overview, Guide and Tutorials The image below shows an example of the conditional "Break Point Manager" that is provided in the power tools pack. Users may define a list of standard or intelligent expression or hit based breakpoints and or tracepoints. Debugging Arduino is as easy as that!

In Arduino terms we might not actually be "breaking" at a breakpoint (optional but not recommended) but, instead, we use breakpoints to allow program flow, variable comparison, variable change reports etc. and status window(s) updates. In short, we get to automatically see what an Arduino is doing just by clicking lines of source code to add breakpoints. Visual Micro Power Tools for Visual Studio is due to be released in March 2012. I think the power tools should cost $29 and will provide a range of features not available in the Arduino IDE or in any other Arduino development tool/plugin. The price should be reviewed based on feed back once a document describing all of the features of the power

pack is released. Some features

Debug output uses specified serial ports of choice. Automatic messages can be configured, variable outputs at breakpoint locations can be returned to a "watch" monitor. Execution trace window shows what your arduino is doing and much more. Carefully considered breakpoints can also be used to automatically open and highlite the line of running source code in almost real-time. Execution trace window shows what your arduino is doing and much more. Custom code injection at any break point (auto added during complation)

How When a debug session starts a secondary high speed background "debug" compile is performed adding efficient C++ serial breakpoint reporting to a temporary copy of the current sketch code. Other code such as break point comparisons and hit counters are also added automatically (program space allowing). Summary The debug tools alone are a great way to see what your arduino program is doing without users having to add any messy debug code! The Visual Studio addin is free, it provides all of the Arduino IDE features and much more. The power tools are not required to program and upload to an Arduino using Visual Studio. The revenue generated by the power tools will fund development of the free plugin. Interesting facts about Visual Studio Breakpoints Existing Visual Studio plugin users not familiar with Visual Studio breakpoints can start to learn and think about Breakpoints/Debugging right now. The breakpoint features of the new debug tools rely on the standard Visual Studio breakpoint features. So open the Visual Studio Breakpoint window using "Debug>Windows>Breakpoints" and add a few breakpoints to your Arduino sketch. Right mouse click a breakpoint in visual studio to set conditions/hit counters etc. Breakpoints will be retained by Visual Studio until you clear them but you can also export/import breakpoints using the tool bar on the breakpoints window. The import/export of breakpoints provides other quite exciting possibilities!
Arduno Debugger - Alpha Preview by Visual Micro 16. February 2012 18:16 This is an aplha preview of the first Arduino debugger that works like a real debugger. An Arduino debugger that can debug projects over any connection type such as Serial, Bluetooth, TCP/Net and Xbee.

Add breakpoints to any line of code and optionaly set a range of properties that enable conditional return of information to the Visual Studio debug listener. This solution removes the need to add debug code to arduino source files and works seemlessly alongside normal serial transmissions. There are many features that will be documented shortly, but a crude example of some features is pictured below. It is not the best screen shot, the trace doesn't reflect

the serial viewer because the view is scrolled for the example

In the example the sketch has "i" as an accumlated sum of Serial.bytesAvailable() and millis() being used both conditionally and as data passed back to Visual Studio. A snippet of arduino code can be entered as a condition or a simple variable (as shown above). The example shows that some breakpoints are configured to show messages that include {variables} $specialFields allowing quite complex messages to be created very easily. The variables in the "Variables" window are automatically defined in breakpoint "When Hit". If only {variables} are then no message is produced but we still see an update to number of times a variable has been hit is also recorded. deduced from the {variables} entered into the "When hit" the variables window. The

Nb: The variables window will be extended to include details of the function the variable relates to.
Summary Variables and/or messages are optionally sent from the arduino simply by altering the properties of each breakpoint. Code comparison/conditions and hit counter measurement are an example of features that enable us to control the frequency of individual debugger updates. Only the variable data is sent from the arduino, all other message text is outputed by Visual Studio. A standalone version of the debugger and serial tools will also be released but later this year. The standalone version will be a simple application that allows arduino

projects to be compiled in debug or release modes and to enable breakpoints to be configured. This means that the debug tools will be available to use alongside other arduino IDEs. There is no reason why the tool will not be "mono" compatible, allowing other non-windows platforms to benefit This arduino debug solution is simple enough to operate over wireless such as xbee and can be used in conjunction with wired (or wireless) arduino programming This tool will be a low price but chargable upgrade to the free Visual Studio IDE Plugin Arduino Debugging Overview - A Practical Debugger by Visual Micro 5. May 2012 06:18

Pre-release documentation for the debugger upgrade due June2012. View all arduino debugging tutorials a video demonstration be available shortly
This is a beta preview of the first Arduino debugger that works like a real debugger. An Arduino debugger that can debug projects over any connection type such as Serial, Bluetooth, TCP/IP and Xbee/Zigbee. The Arduino for Visual Studio debugging tool seemlessly combines simple debug features with Arduino programming and upload. The Arduino debug tool allows us to make use of the powerful source code breakpoint features of Visual Studio. By default, the arduino debugging works over a serial connection by optionally injecting code during a debug compilation. The arduino debugger connection type can be overriden using a number of standard options such as "software serial" and "bluetooth" or you can write your own custom connection (debug data transport) handler that uses bespoke arduino hardware. Please read and fully understand all of these documents if you are working on dangerous projects such as critical devices and/or moving machines. Click the "back/forward" option above this article to progress through the available debug tutorials and examples

The primary advantages of the Visual Micro tool are as follows:-

Make arduino debgging as simple to implement as it is for a normal programming project. (example: F5 debug upload and F5 breakpoint continue) Provide a simple way to conditionally trace/break a running Arduino program Provide dynamic views of selected variables at any pre-set point of a running Arduino program Clearly show the code that is being executed at any given time Remove the need to alter source code by adding debug statements Show a list of all known variable values and allow double click to source code Optionally display a running view of which line of source is currenly being executed Show the difference between running source code and the current source (useful if the source has altered since upload) Show the time/duration between points in the source code Allow import/export of breakpoints

For most users, it is possible that the advantages outweigh the disadvantages but in all cases the disadvantages should be carefully considered prior to enabling debugging or purchasing the upgrade:Disadvantages of Code Injection

Causes the Arduino to do more work that it would under "Release" (normal) running conditions. It is important to know if a project will be adversly affected by a change in processor load/timings The program size will increase for each breakpoint, if variable data is being returned the program size will also increase for each named variable and if a conditional breakpoint is set the program size will increase depending on the condition(s) that you specify The current debug tool has the ability to share a serial port but only if it is being used in text mode. The serial port used for debugging can be re-specified to a different deidcated debug serial port but this will hog a serial port. Software serial or network will be options in future versions but all of these options might consume additional program memory Due to memory limitations it is not possible to step each line of code after a breakpoint has been hit. It is only possible to step between each breakpoint.

IMPORTANT WARNING - Enable Break/Pause causes the Arduino to STOP/WAIT when a breakable point in the source code is reached. You must only enable this option if you understand the consequences of the Arduino stopping and waiting for an F5 (continue) command. Further more, because the debug uses the serial port to communicate any transmission to the arduino serial port will cause the arduino to continue. REMOVE all propellers and consider the dangers of debug pause prior to using this feature! For this reason the default for this option is false (off) which forces all break points to become tracepoints regardless of their settings. 02 - Enable Arduino Debugging by Visual Micro 5. May 2012 07:05

Pre-release documentation for the debugger upgrade due June2012

In the full product version of the Visual Studio plugin the project properties window can be used to set "per configuration" Arduino settings. The properties window is opened by clicking on the project name in the solution explorer and either pressing F4 or selecting the menu "View>Properties Window". You can see that one of the settings is "(Micro Debug)". Set "(Micro Debug)" to "True" to enable Arduino debugging.

-- F4 -->

"Per configuration" means that the settings are saved based upon the current Visual Studio configuration such as "Release" or "Debug". In the following example the configuration is set to "Debug"

Bear in mind that if you don't configure a source trace/break point(s) then you won't see very much in the trace other than an Arduino startup confirmation message. To avoid confusion it is recommened that debug is enabled when Visual Studio is set to the "Debug" configuration. This then allows the configuration option to be used to quickly switch between a Release or Debug Arduino build and upload.

IMPORTANT WARNING - Enable Break/Pause causes the Arduino to STOP/WAIT when a breakable point in the source code is reached. You must only enable this option if you understand the consequences of the Arduino stopping and waiting for an F5 (continue) command. Further more, because the debug uses the serial port to communicate any transmission to the arduino serial port will cause the arduino to continue. REMOVE all propellers and consider the dangers of debug pause prior to using this feature! For this reason the default for this option is false (off) which forces all break points to become tracepoints regardless of their settings. 03 - Arduino Debugging Settings Explained by Visual Micro 5. May 2012 08:04

Pre-release documentation for the debugger upgrade due June2012

The project properties window is available when the project is selected in the Visual Studio solution explorer. Properties in the "Micro Debug" section are only used if (Micro Debug) is enabled (see the example below). The properties are the Arduino debugging options that are available. IMPORTANT WARNING - Enable Break/Pause causes the Arduino to STOP/WAIT when a breakable point in the source code is reached. You must only enable this option if you understand the consequences of the Arduino stopping and waiting for an F5 (continue) command. Further more, because the debug uses the serial port to communicate any transmission to the arduino serial port will cause the arduino to continue. REMOVE all propellers and consider the dangers of debug pause prior to using this feature! For this reason the default for this option is false (off) which forces all break points to become tracepoints regardless of their settings.

Jump To Source is automatically enabled when a pausable breakpoint is hit. This forces jumping to source for all tracepoints so must be used with consideration fast visual studio can react. For example if we only trace when a sensor button clicked or when a condition happens infrequently (such as every 20 seconds or longer) then this option can provide a useful animated view of the code that is executed.

option to how is being

Remote Port enabled us to override the serial port that the debugger uses. By default it uses the main Arduino Serial port and initialises the port speed to 115k. You may

optional override the speed of the port or both the speed and the port. This option might be useful if you already use the main serial port or if you want to manually initialise the debug port in the sketch setup() function. Startup Message provides the ability to send a startup message from the arduino when it is in debug mode Startup Wait is used in cojuntion with Enable Break/Pause and automatically forces the arduino to wait for F5 (continue) when it starts or resets. The Startup message is displayed in the trace then the Arduino will pause Tip: Press F4 or "View>Properties Window" if the debugging properties are not displayed. The visibility and position of the project properties will be remebered when you restart Visual Studio 04 - Creating a Simple Arduino Debug Tracepoint by Visual Micro 5. May 2012 09:09

Pre-release documentation for the debugger upgrade due June2012

In this example we create a simple debug trace point using the main Arduino serial port and the default Visual Micro settings. This article assumes that arduino debugging in Visual Studio has been enabled (see this post for a how to). The Visual Studio Debugger Breakpoints Window is opened using CTRL+ALT+B or by clicking the menu item Debug>Windows>Breakpoints. Alternatively you can right mouse click the tool bars and show the "Debug" bar as shown below above the source code. In the example below the breakpoints window is displayed below the source code. A single breakpoint has been added by clicking the left margin of the source.

During compilation - How are breakpoints added to a temporary copy of the code?

During compilation, breakpoints are added to the end of the selected code line, can not be added to comment lines but can be added to empty source lines. Adding breakpoints to empty source lines is recommended because it ensures you are happy with the exact position the debug code will be added to a copy of the code. For example, consider the following line of code:if (foo) {a=0;} In the above example the debug engine would compile the following code which involves a significant code change and might, in a more complex example, lead to unexpected results. The debug engine tries a few tests to attempt a code injection and might fail or produce the wrong code. Hence the rule, add breakpoints to empty or simple lines of codes.

if (foo) { a=0; //some debug commands will be inserted here } SUGGESTION: Add debugger breakpoints to empty or simple lines of codes, see why at the end of this section
05 - Arduino Debug Basic Trace Point by Visual Micro 5. May 2012 14:11

Pre-release documentation for the debugger upgrade due June2012

When debuging has been enabled for a configuration a debug session can be started by pressing F5, clicking menu item "Debug>Start With Debugging" or the standard "Start Debugging" icon on the Visual Studio tool bar. The first thing to note is that two compilations are performed. The first is normal compilation of the sketch to ensure it is free of errors then the second to include debug information. Below you can see the difference in memory between a release and debug build. The difference would be smaller if our test sketch already referenced the serial port and other basic arduino properties. Therefore this example probably represents a worst case senario.

If the serial port monitor was already open prior to upload then Visual Studio automatically displays the debug trace window. Otherwise the serial port monitor should be opened for the trace window to be displayed. The example below shows a running tracepoint. In a real world project we might have multiple break or trace points. Double clicking the trace point will jump to the correct line in the source code.

06 - Arduino Debugger Trace Messages and Variables/Expressions by Visual Micro 5. May 2012 14:30

Pre-release documentation for the debugger upgrade due June2012

Right mouse clicking a debugger break point in the source code or in the debugger Breakpoints Window (CTR+ALT+B) provides a number of menu items relevent to the breakpoint.

Clicking the debug "When Hit" option opens the following dialog window allowing us to optionally print a message that includes variable data or we can just report variables to the debug tool. Debugger messages can be as long as is needed because they are not compiled into the Arduino program. Messages are stored locally on the pc and displayed when a break or trace point is hit.

The example below shows how to create a dynamic trace message that includes variable data. Note that requests for variable data are enclosed in {brackets}. Any expression that returns a numeric (int, float etc) value is allowed and any number of expressions can be included in the message. The "Run Macro" option will be supported in future versions of Visual Micro. The "Continue Execution" feature is only relevent if "Debug Break/Pause" is enabled. After making changes to arduino debugger breakpoints or source code the project must be compiled and uploaded. The easiest way is to press F5

If the debug message soley consists of expressions (no text) then a trace message entry is not displayed. The variable/expression inspector shown below will automatically open when a debug session starts. Double click arduino debugger variables and/or trace message to jump to the respective source code line.

07 - Debug Arduino Conditonal Breakpoints and Tracepoints by Visual Micro 5. May 2012 15:25

Pre-release documentation for the debugger upgrade due June2012

If we need to debug fast running arduino code we might only want to trace exceptions or conditions within a certain range. Visual Micro allows any expression to be used as an arduino breakpoint condition. To add a debug conditon to an arduino breakpoint we can use the right menu menu to select the breakpoint options menu. it is also possible to set a "Hit Count" allowing a tracepoint to be reported every x times that it is executed (hit) by the arduino cpu.

The example below shows an arduino debugger tracepoint that reports when a random number of between 0 and 2000 has a value between 1000 and 1500. The debugger tracepoint reports the value of i and also the value of the Arduino millis() (milliseconds since startup). "Is True" or "Has Changed" may be used to distinguish between the type of condition that is required. In each case the expression entered must either return boolean true/false or a value. The example below uses the "Is True" condition to ensure the value of i is within the given range.

The image below shows this conditional tracepoint when an arduino is running in debug mode. Notice the variables viewer displays both variable and expression along with min and max values. In the example below the min and max values of the condition have already been reached.

Items in red show data that has changed since the last point was hit.

08 - Arduino Debugger Source Code Modification Tracking by Visual Micro 5. May 2012 16:24

Pre-release documentation for the debugger upgrade due June2012

A debug session continues on the Arduino until a release program/sketch version is upload therefore it is possible for the source code to be different from the source code running on the Arduino. For this reason breakpoint configuration and source code is saved during compilation and used to display messages and variable data during debug. Tip: Hovering over the name of a breakpoint provides a summary of the code that was uploaded to the Arduino. In the example below we see that the Arduino is using a random number between 0 and 2000 when the code has been altered to between 0 and 4000

09 - Arduino Debugger Running Variables and Expressions Viewer by Visual Micro 5. May 2012 16:40

Pre-release documentation for the debugger upgrade due June2012

In addition to showing hit data the Variables and Expressions Window provides a number of additional columns that are enabled by right clicking the list (as shown below)

As with all Visual Micro windows the Variables Window can be docked. The windows position is retained on a port by port basis and scrolling locks the variables/expression name column to provide clearer analysis During arduino program debug, variables and expressions are automatically displayed inside a grid grouped by breakpoint location. Double clicking a variable of breakpoint will jump to the respective line of source code

10 - Arduino Debugger Optional Message Viewers by Visual Micro 5. May 2012 16:47

Pre-release documentation for the debugger upgrade due June2012

Visual Studio provides a number of text message views during a arduino debug session. Configuration of which windows are used to view messages is available using the debug options sub menu on the active debugger Serial window as shown below. Messages can be directed to any combination of 3 windows:

Serial Viewer Message Viewer Trace Viewer

The example above would allow messages to be appear in a dedicated message window (as shown below) and also in the trace window (as shown in previous posts). Below shows a "message only" window which is free of trace messages

Below shows a "trace only" window which is free of messages. The example below was created by unticking the "Trace" sub menu shown at the start of this post.

11 - Share The Arduino Serial Port With The Debugger by Visual Micro 5. May 2012 17:16

Pre-release documentation for the debugger upgrade due June2012

The example below shows a single Arduino Serial Port being used for both debug and static serial messages. The example goes one step further by making use of the DEBUG symbol allowing the static messages to only be included in the program when debuging is enabled for the project.


In the example above the code in the Serial.begin() in the setup() function is not required because both the debugger and the project are using the same port. However, if the defined(DEBUG) condition is removed from the code then Serial.begin() would be required. Therefore it is safer to add Serial.begin() if your sketch code directly uses the Serial port. The same would apply if the debug "Remote Port" on the project properties was set to a port other than "Serial". In this case you would certainly need to initialise the Serial port. 12 - Optionally make use of the DEBUG symbol in your Arduino code by Visual Micro 5. May 2012 17:36

Pre-release documentation for the debugger upgrade due June2012

When debuging is enabled the DEBUG symbol allows code to be used "instead of" or "in combination with" the Visual Studio debug tools

13 - Arduino Debug Break/Pause Into Source Code by Visual Micro 5. May 2012 17:59

Pre-release documentation for the debugger upgrade due June2012

The example below shows both automated and manual arduino source debugging features. The "old style" manual debug of arduino is shown in the code. Some of the automated features are shown in the "When Breakpoint hit" dialog Individual points in your Arduino source code can be configured to break/pause or simply trace/continue without pause. The configuration settings change depending on the type of break or trace point. When a break/pause is hit Visual Studio will automatically open and select the line of arduino source that contains the current break point.

Most points can be configured to either continue or break/pause using the breakpoint message window as shown below. Untick the "Continue Execution" checkbox to force a pause. Behind the dialog in the example we can see that the Arduino is paused on a breakpoint. Pressing F5, clicking any of the Visual Studio "Start>debug" commands or sending any serial data will re-start the Arduino program.

IMPORTANT WARNINGS! It is only right that we make the following statements very clearly... Before enabling Arduino debug "break/pause" you must carefully consider what will happen if the Arduino suddenly stops on a breakpoint. Will your flying machine drop out of the sky and injure someone or be damaged. Will a robot crash? Will a motor be stuck on full power? Will a device stop responding and cause a critical problem? This is entirely your responsibility, if you are in any doubt then ask questions on the forum but please do not use this feature until there is no doubt! The same applies to the ability for the Arduino to pause at startup. All arduino debug pause features provided in Visual Studio can not be relied upon in sensitive or dangerous siutations. This is because of the use of the serial port for the debug "continue" command. In the current version any data transmitted over the debug serial port will cause the Arduino to continue program execution which might be unexpected in many cases such as electrical interference and stray serial data. Debug break/pause should only be used with breakpoints that will be hit every so often otherwise you will spend your time hitting F5 (continue) lots and lots of times :) If you mistakenly set a break condition that happens to often you will find that you can untick the "connect" checkbox on the serial window to stop the serial comms. This will, ineffect, stop the debug session but bear in mind that the Arduino will still be in debug mode.

Because the Arduino can be in debug mode and might be paused while Visual Studio is not in debug mode it is suggested that you either upload a "release" version when you finish debugging. This will ensure the Arduino is always in a known state. It is strongly recommended that you switch on the DTR setting on the serial window or in the Visual Micro options. The DTR setting will ensure that the Arduino is reset whenever the serial window connects and/or debugging starts. Without the DTR setting it possible to start debuging when the Arduino is already paused on a beakpoint which will be confusing for most users. Debug Break/Pause is enabled by selecting the project in the Solution Exporer and viewing the properties window (not right mouse click properties, the Property Window). Set Enable Break/Pause to True. Each time Break/Pause is enabled for a project a warning is displayed.

14 - Arduino Debug Hit Count Conditions by Visual Micro 5. May 2012 18:36

Pre-release documentation for the debugger upgrade due June2012

Instead of, or in combination with a conditonal breakpoint expression (as described in earlier posts) to make an Arduino trace or break point we can use the "Hit Count" dialog. The hit count dialog is opened by right clicking any break break and selecting "Hit Count" from the menu that appears (described in detail in earlier posts). The Hit Count dialog allows us to select 4 options. The example below is self explanatory. If we are adding a break point into a frequent arduino loop we might set a hit count of 30000.

Tip: The hit count is automatically combined with any conditional expression (as described in earlier posts). Example if an expression is true every second and we set a hit count of 30 then we would encounter a break or trace every 30 seconds. A hit count will continue by default but can a cause break into source code. Please read the previous post for more information and important warnings about enabling breakpause with an arduino processor 15 - Arduino Debug Break Points Can Be Disabled But ... by Visual Micro 5. May 2012 18:46

Pre-release documentation for the debugger upgrade due June2012

You will notice that in Visual Studio breakpoints can be disabled. Visual Micro always sends all breakpoints to the Arduino during compilation but will stop reporting disabled breakpoints. This means you can switch on/off breakpoints during a single debug session by enabling or disabling them. If using debug break/pause with disabled breakpoints the breakpoint will still be active in the arduino but the pc will automatically send an F5. This means that disabled breakpoints will still cause the Arduino to work more slowly than normal but that the breakpoint will not require users to manually press F5. This feature might be useful in some situations or to freeze the variables window for certain variables. It is recommended that breakpoints are exported and/or deleted when not being used. Arduino Debug Release Information - Breakpoints Example by Visual Micro 19. May 2012 13:59 The Arduino debugger upgrade for Visual Studio is due for release in June 2012. The date has slipped slightly due to high work loads. The debugger includes eveything required to set conditional breakpoints, trace messages, expression reporting step through predefined debug points. The Arduino debug tool does not require you to make any code modifications to your arduino source code so it is fully automated.

In the Arduino breakpoints below we see 5 breakpoints of various types. Two breakpoints have conditional expressions, one breakpoint produces a trace message and also reports the value of variable i. An unlimited number of Arduino variables to watch can be set per breakpoint, the message is also optional. Two breakpoints have hit conditions (n times before each hit)

Read more about the Arduino Debug Tool Please EMAIL beta @ if you would like to be a beta tester Arduino Leonardo Upload Differences by Visual Micro 2. June 2012 08:15 The Arduino Leonardo is a usb device that works in a different way to older or existing Arduino hardware. When a Leonardo starts it breifly appears in programming mode on a different serial port to the one it normally uses. When an Arduino upload request begins the specified Leonardo serial port is polled at 1200 baud causing the Leonardo to reset. If the port is not found, both the Arduino and Visual Studio IDEs assume that the Leonardo has been reset or was resetting/starting and skip the attempt to reset. Both Visual Studio and the Arduino IDE, scan to detect the new programming port appearing in the computers serial ports list which indicates a Leonardo startup has been detected. If a new port is not detected then both IDEs' will wait for 5 seconds (on windows) before raising the error:- "Couldnt find a Leonardo on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload." On Microsoft windows, once the upload has completed, there is a 0.5 sec pause to ensure the Leonardo has re-booted and that the original serial port has re-connected. After upload, Visual Studio confirms the actual upload port to the user using the "Sketch Output" tab. An example Leonardo upload message is shown below. Notice the switch from Leonardo serial COM37 to COM38 Compiling 'MySensor' for 'Arduino Leonardo' Binary sketch size: 4844 bytes (of a 28672 byte maximum) (0.507 secs)

Uploading to I/O board using 'COM37' Done uploading via 'COM38' Arduino Leonardo - Windows Hardware USB Installation Guide by Visual Micro 2. June 2012 05:43 Windows (tested on XP and 7) The process for Windows XP and Windows 7 is similar. These screenshots are from an XP installation.

Plug in your board and wait for Windows to begin its driver installation process. If the installer does not launch automatically, Navigate to the Windows Device Manager (Start>Control Panel>Hardware) and find the Arduino Leonardo listing. Right click and choose Update driver. If prompted to search for drivers online, choose "No, not this time". And click Next

When asked to install automatically or from a specific location, select "Install from a list or specific location" and press Next

Choose "Search for the best driver in these locations", and check the box "incude this location in the search". Click the Browse button and navigate to your Arduino 1.0.1 or later installation. Select the drivers folder an click OK

Click Next You will receive a notification that the Leonardo has not passed Windows Logo testing. Click on the button Continue Anyway

After a few moments, a window will tell you the wizard has finished installing software for Arduino Leonardo. Press the Finish button

Original article found on