Code Monkey home page Code Monkey logo

vscode-arduino's Introduction

Visual Studio Code extension for Arduino

Gitter Travis CI

Welcome to Visual Studio Code extension for Arduino preview ! The Arduino extension makes it easy to code, build, deploy and debug your Arduino sketches in Visual Studio Code, with a rich set of functionalities:

  • IntelliSense and syntax highlighting for Arduino sketches
  • Verify and upload your sketches in Visual Studio Code
  • Built-in board and library manager
  • Built-in example list
  • Built-in serial monitor
  • Snippets for sketches
  • Automatic Arduino project scaffolding
  • Command Palette (F1) integration of frequently used commands (e.g. Verify, Upload...)
  • Integrated Arduino Debugging New

Prerequisites

Arduino IDE is required. Please install it from here.

  • The supported Arduino IDE versions are 1.6.x and later.
  • The Windows Store's version of Arduino IDE is not supported because of the sandbox environment of Windows app.

Installation

Open VS Code and press F1 or Ctrl + Shift + P to open command palette, select Install Extension and type vscode-arduino.

Or launch VS Code Quick Open (Ctrl + P), paste the following command, and press enter.

ext install vscode-arduino

You can also install directly from Marketplace within Visual Studio Code, searching Arduino.

Get Started

You can find code samples and tutorials each time you connect a supported device. Alternatively you can visit our IoT Developer Blog Space or Get Started Tutorials.

Commands

This extension provides several commands in the Command Palette (F1 or Ctrl + Shift + P) for working with *.ino files:

  • Arduino: Board Manager: Manage packages for boards. You can add 3rd party Arduino board by configuring Additional Board Manager URLs in board manager.
  • Arduino: Change Baud Rate: Change the baud rate of selected serial port.
  • Arduino: Change Board Type: Change board type or platform.
  • Arduino: Close Serial Monitor: Stop serial monitor and release the serial port.
  • Arduino: Examples: Show example list.
  • Arduino: Initialize: Scaffold a VS Code project with an Arduino sketch.
  • Arduino: Library Manager: Explore and manage libraries.
  • Arduino: Open Serial Monitor: Open serial monitor in the intergrated output window.
  • Arduino: Select Serial Port: Change the current serial port.
  • Arduino: Send Text to Serial Port: Send a line of text via the current serial port.
  • Arduino: Upload: Build sketch and upload to Arduino board.
  • Arduino: Verify: Build sketch.

Options

The following Visual Studio Code settings are available for the Arduino extension. These can be set in global user preferences Ctrl + , or workspace settings (.vscode/settings.json). The later overrides the former.

{
    "arduino.path": "C:/Program Files (x86)/Arduino",
    "arduino.additionalUrls": "",
    "arduino.logLevel": "info", 
    "arduino.enableUSBDetection": true
}
  • arduino.path - Path to Arduino, you can use a custom version of Arduino by modifying this setting to include the full path. Example: C:\\Program Files\\Arduino for Windows, /Applications for Mac, /home/$user/Downloads/arduino-1.8.1 for Linux. (Requires a restart after change). The default value is automatically detected from your Arduino IDE installation path.
  • arduino.additionalUrls - Additional URLs for 3rd party packages. You can have multiple URLs in one string with comma(,) as separator, or have a string array. The default value is empty.
  • arduino.logLevel - CLI output log level. Could be info or verbose. The default value is "info".
  • arduino.enableUSBDetection - Enable/disable USB detection from the VSCode Arduino extension. The default value is true.

The following settings are per sketch settings of the Arduino extension. You can find them in .vscode/arduino.json under the workspace.

{
    "sketch": "example.ino",
    "port": "COM5",
    "board": "adafruit:samd:adafruit_feather_m0",
    "output": "../build",
    "debugger": "jlink"
}
  • sketch - The main sketch file name of Arduino.
  • port - Name of the serial port connected to the device. Can be set by the Arduino: Select Serial Port command.
  • board - Current selected Arduino board alias. Can be set by the Arduino: Change Board Type command. Also, you can find the board list there.
  • output - Arduino build output path. If not set, Arduino will create a new temporary output folder each time, which means it cannot reuse the intermediate result of the previous build, leading to long verify/upload time. So it is recommended to set the field. Arduino requires that the output path should not be the workspace itself or subfolder of the workspace, otherwise, it may not work correctly. By default, this option is not set.
  • debugger - The short name of the debugger that will be used when the board itself does not have any debugger and there are more than one debugger available. You can find the list of debuggers here. By default, this option is not set.

Debugging Arduino Code preview

Before you start debug your Arduino code, read this doc and get to know the basic mechanism about debugging in Visual Studio Code. Also see debugging for C++ in VSCode for your reference.

Make sure your Arduino board can work with STLink, Jlink or EDBG. The debugging support currently is fully tested with the following boards.

Steps to start debugging:

  1. Plugin your board to your development machine properly. For those boards don't have on-board debugging chip, you need use STLink or JLink connector.
  2. Go to Debug View (Ctrl + Shift + D). Set breakpoints in your source files.
  3. Press F5 to select debugging environment.
  4. When your breakpoint is hit, you can see variables and add expression to watch on the Debug Side Bar.

To learn more about how to debug Arduino code, visit our team blog.

Change Log

See the Change log for the details of changes for each version.

Supported Operating Systems

Currently this extension supports the following operatings systems:

  • Windows 7 and later (32-bit and 64-bit)
  • macOS 10.10 and later
  • Ubuntu 16.04
    • The extension might work on other Linux distro as some user reported but without gurantee.

Support

You can find the full list of issues at Issue Tracker. You can submit a bug or feature suggestion, and participate community driven discussions.

Development

Installing Prerequisites:

To run and develop, do the following:

  • git clone https://github.com/microsoft/vscode-arduino
  • cd vscode-arduino
  • Run npm i
  • Run npm i -g gulp
  • Open in Visual Studio Code (code .)
  • Press F5 to debug

To test do the following: F5 in VS Code with the "Launch Tests" debug configuration.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information please see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Privacy Statement

The Microsft Enterprise and Developer Privacy Statement describes the privacy statement of this software.

License

This extension is licensed under MIT License. Please see the Third Party Notice file for additional copyright notices and terms.

Contact Us

If you would like to help build the best Arduino experience with VS Code, you can reach us directly at gitter chat room.

vscode-arduino's People

Contributors

yaohaizh avatar testforstephen avatar andxu avatar akaroml avatar deqingsun avatar eduherminio avatar codeworm96 avatar lialosiu avatar sffamily avatar atalanttore avatar v-czg avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.