11

I am currently programming a Teens y2.0 using the Arduino IDE with Teensyduino. It works but Arduino IDE is rubbish, so I would like to use VS Code. However while the Arduino VS code plugin works fine, it doesn't recognise the Teensy as a board, even though Teensyduino installs its libraries etc into the Arduino IDE package.

Does anyone know how to add Teensy support to VS Code or an alternative IDE I can use that will recognise the board?

OSX Sierra / VS Code with vscode-arduino plugin v0.24 / Teensy 2.0

dda
  • 6,030
  • 2
  • 25
  • 34
AJ.
  • 1,226
  • 1
  • 16
  • 21
  • 1
    My workaround, though cluggy, was to disable the VS Code plugin, install a C/C++ language plugin, create a blank sketch with Arduino IDE, set it to use an external editor, and then edit the sketch using VSCode, but build using the ArduinoIDE. – AJ. Aug 14 '17 at 09:21
  • I've been trying to figure this one out. @AJ how difficult was it to set it up with your editor / build settings? Could you post this as a potential solution with the steps involved? – sidewaiise Dec 02 '17 at 06:03
  • This is an old question but still ranks high on Google when searching - just FYI there is a VSCode plugin called PlatformIO that supports Teensy from VSCode now - works great. – meshtron Jul 26 '19 at 15:39

1 Answers1

6

You can use PlatformIO with Visual Studio Code (or with many other major IDEs, or even from the command line). PlatformIO is a build system (sort of like Make, but with a lot more power) for all kinds of embedded platforms.

To get started:

  • Run Visual Studio Code
  • Choose Preferences / Extensions
  • Search for "PlatformIO" and click Install
  • Reload VS Code when prompted
  • In the PIO Home window, click on the BOARDS icon
  • Find your Teensy board. Look in the Platform column and click on Teensy there.
  • This will take you to a screen where you can install the Teensy Platform.

To see it working:

  • Go to the PIO Home (There is a little house icon in the lower left of your VS Code window if you lost it)
  • Click Project Examples
  • Select Teensy > Arduino Blink
  • Find the platformio.ini file it gives you, and delete all the extra sections except for your particular Teensy board
  • In the lower left corner of the VS Code screen, you'll see a checkmark icon which builds and a right arrow icon which installs the HEX file on your Teensy, just like the Arduino editor.

You will still need Teensyduino!

[Hat tip to Mikah Barnett for the answer in the comments]

Joel Spolsky
  • 33,372
  • 17
  • 89
  • 105