Thanks to
Ken Perry for investigating and recommending Visual Studio Community 2015 as an
accessible Windows environment for programming Arduino. This method requires
some time and effort to set up, but once it’s done it offers screen-readable
line numbering, error reporting, serial monitoring and code completion, among
other advantages. I found that JAWS 17 and NVDA 2016.1 work equally well with
Visual Studio Community. If you’d like to give VSC a try, here’s how:
Installation
Arduino IDE
You’ll
still need to start out by downloading the Arduino IDE; you won’t be opening or coding in this IDE, but a Visual
Studio plug-in needs to use the Arduino compiler behind the scenes. If you
already have the IDE, check to make sure it’s the latest version; if it isn’t,
download the current version before moving on. (Note: at this writing, the
current version is 1.6.9. It’s of course possible that a future version will be
incompatible with VSC. A quick Google search of the current IDE version and VSC
version should let you know whether they’re working together). It’s a good idea
to put the Arduino folder at the root of your hard drive: by default it
installs within C:\Program Files, which can cause problems with permissions
down the line. If you already have the IDE installed, you can just copy the
whole Arduino folder from C:\Program Files to C:\.
Visual Studio Community 2015
Visual
Studio Community is available as a free download. While
the initial download is relatively small, budget some time (it took me around
45 minutes with a decent wifi connection) for the VSC installer to acquire and
configure additional files, and make sure you have 12 gb of free storage space
(8 for VSC, 4 for Visual C++) before you begin the setup process. The necessary
controls to move through installation are readable with both JAWS and NVDA. To
monitor the progress of installation, use the touch cursor (JAWS) or object
navigation (NVDA). You may notice some “phantom controls” above the progress
information that refer to ending a session, cancelling setup, and choosing an
installation location. Don’t worry about those; keep your attention on the
reassuring movement of the files being installed and the progress percentage.
Note:
Before you start the installation, read ahead to the section of Visual C++. If
you choose a custom install for VSC, you can skip an extra step later on:
however, I haven’t tested this myself so I’ll be describing the (probably
longer) path I took.
When
setup is done, activate the “Launch” button. You’ll be prompted to sign in or
create an account to connect to developer services, but you can tab and choose
“Not Now, Maybe Later” if you’d rather not.
Next,
you’ll be prompted to choose your development settings (the default, “General”,
is fine) and a color theme. Tab and choose to “Start Visual Studio”, and go
make a cup of tea or something; it takes about two minutes for VSC to configure
itself.
You are
now in a world of buttons leading to tutorials, news, videos and more. You can
tab through these if you’d like to explore them.
Visual C++
You’ll
need to install Visual C++ before programming your Arduino. If you didn’t do
this when you first installed VSC, navigate to the File Menu>New>Project.
In the dialog box of extension providers that appears in focus, choose Visual
C++. Tab several times to a list of extensions and choose “Install Visual C++”.
This installation took me about 15 minutes and all screens were readable,
although I encountered “phantom messages” similar to the ones I described when
installing VSC.
The Arduino Plug-in
Navigate
to Tools>Extensions and Updates to install the Arduino Plug-in, otherwise
known as “Visual Micro”.
Within
the Extensions and Updates dialog box, shift-tab once and change the combo box
from “Installed” to “All” (sorry, this box’s label seemed unreadable by NVDA).
Then, tab to the search box and type in “Arduino”. Tab to the table of
extensions, where “Arduino IDE for Visual Studio” should be your top hit. Tab
once more to Download, and press enter to initiate download and installation.
(You may need to say “Yes” to a User Account Control at this point”). One more
dialog box will appear; choose Install, and follow the prompt to restart VSC.
(If you receive an error message stating that “per user extensions” could not
be loaded, close VSC; set its properties to always run as an administrator; and
reopen it.
When VSC
restarts, you’ll be placed in a dialog box to configure IDE locations. (You’ll
also be shown a window containing the Arduino for Visual Studio documentation).
Choose your Arduino IDE version and the installation path for your Arduino IDE,
then tab and choose OK. At this point, I was presented with a message reading
“toolchain reloaded” and the only way to dismiss it was to close and reopen
VSC.
Getting ready to program
Select your toolbars
Navigate
to View>Toolbars and select all four Micro toolbars (Boards, Project,
Programmer, Serial Communications).
Configure VSC to work with your board
Visual
Studio Community can work with a wide variety of microcontrollers, including
Arduino. You need to specify your board and how it’s connected before you can
write programs to your Arduino.
Connect
your Arduino and find out what com port it’s using. To do this, open your
Device Manager and expand the “Ports, Com and LPT” section.
In VSC,
navigate to the “Micro Boards” toolbar (you can do this by pressing Alt for the
menu bar and then pressing Control+Tab until you find the toolbar). The first
combo box you find, Micro Applications, will specify your IDE version. Tab once
to the Board combo box and choose your Arduino model. (Pro tip: the first
choice here is “Arduino Yún” which sounds a lot like, but emphatically is not,
the same thing as “Arduino Uno”. Do not waste time choosing this option and
failing to program your Uno: I’ve already done that for you).
After you
choose your board, navigate to the Micro Serial Communications toolbar and
choose your board’s com port.
Writing a Program
To create
your first project, navigate to File>New>Arduino Project. Give your
project a name and press enter. A blank sketch is always populated with lines
for “Void Setup” and “Voic Loop”, along with comments (bracketed by /* and */)
explaining what those sections mean. If you’re writing code by hand, leave
these in place; if you’re pasting in a code example that already has these
sections, select and delete the existing text before you paste.
Uploading the Program
To upload
your program, press Control+F5. If VSC finds errors, it will list them for you,
by line and column number. If not, it will let you know whether the program
finished uploading. In either case, to dismiss the message and get back to your
code, press Escape.
Closing and re-opening your program
VSC
refers to programs, which can include your Arduino sketch and any associated
files, as “Solutions”. Navigate to File>Close Solution when you’re done
working with a program, and follow the prompt to save or discard changes. To
open a program you’ve previously created, navigate to File>Open>Arduino
Project.
Chancey: Thanks SOO much for putting together this awesome guide to getting up and running with VS and Arduino. I'm looking forward to getting this set up as soon as I have a free afternoon. :-)
ReplyDeleteIt looks a whole lot easier to use than the command line interface, so I'm really excited about getting beginners up and running with this development environment.
Thanks again for doing this, and thanks to Ken Perry of the American Printing House for the Blind for blazing this trail for the community!
Wow -- you weren't kidding! It took me pretty much all afternoon, but I got it installed and configured, and it totally works. It was a lot of work to set it up, but it's totally worth it, particularly for folks who don't feel completely comfortable on the command line.
ReplyDeleteIt's awesome to simply hit a couple of keys within your editing environment and have the project upload and start running. It's also nice to see readable error messages when it doesn't.
Altogether, VSC is probably the best setup we have so far for blind Arduino development.
The biggest problem I found during installation was the ghost messages and controls in the installer dialog. They can be extremely confusing because it's sometimes quite hard to tell which messages and buttons are real, and which are phantoms that aren't showing up on the screen. Nevertheless, I did get through it without needing to bring in someone with eyes.
Thanks for documenting this for us -- awesome job!
Here is a great link to copious quantities of keyboard shortcuts for Visual Studio 2015:
ReplyDeletehttp://visualstudioshortcuts.com/2015/
This comment has been removed by the author.
ReplyDeleteThanks so much for publishing. Here are the links to the Visual Micro Arduino plugin mentioned in the article:-
ReplyDeleteHome: http://www.visualmicro.com/
User Guide: http://www.visualmicro.com/page/User-Guide.aspx