Skip to content
  • Home
  • Account
  • Restricted content
  • OBEX
  • Chips Tips
  • Logout
  • Shop
  • QuickBytes
Propeller OBEX
  • OBEX
  • Forum
Login
Propeller OBEX

Propeller 2

  • Configuring Visual Studio Code for Programming the P2 on Mac, Windows, and Linux
  • Breakout Board Options for P2 Edge Modules
  • Solar Panel Monitoring Demo (Intro to Using Video 3 of 3)
  • Wireless Programming with the ESP8266 WX Module
  • Brushless DC Motor Control Demo
  • Colorful Terminal Output with ANSI Escape Sequences
  • XBee RF Transparent and API Mode Demo
  • DS3231 Real Time Clock I2C Demo
  • Multiple Servo Control (up to 64) Object
  • Multiple Serial Port (8 UART – 16 Tx/Rx) Object
  • Goertzel Operation with Ultrasonic Transducers
  • Web Page Control of WS2811 LEDs Using the IoT Gateway on Raspberry Pi
  • 320×240 LCD Driver for ILI9341 Controller and XPT2046 Touch Screen
  • Digital Sample ADC to DAC + Analog Frequency to DAC
  • Using Smart Pins to Measure Frequency Output of TSL235R Light-to-Frequency Sensor
  • Ping))) Ultrasonic Distance Sensor with Graphical Debug Demo
  • Simple Analog Input
  • P2 Edge 16 MB Flash Reader and Explorer Utility
  • LED Matrix used as an I/O Test Utility
  • Arlo Conversion to P2 with the Universal Motor Controller
  • Five Buttons On One Pin
  • P2 RTC Add-on Board Demo
  • Simple Video Driver – Using Images (Intro to Using Video 2 of 3)
  • Starting Your P2 Project with a Spin2 Template
  • E-Ink Display Demo
  • MAX7219 LED Display SPI Demo
  • DHT11, DHT22, CM2302 Humidity and Temperature Sensor Object
  • NMEA GPS String Parsing
  • Floating Point Math: DEBUG and Terminal Display Example
  • LEDs – Beyond the Basics
  • Quadrature Encoder Object
  • P2 RTC Add-on with GPS Module
  • DVI/VGA Text Driver Demo
  • PCF8574 I2C LCD Demo
  • Simple Sound Engine Demo
  • 1-Wire Driver with DS18B20 Temperature Sensor Demo
  • Send Email from the Propeller 2 Using the IoT Gateway on Raspberry Pi
  • I2C Device Bus Scanner Utility
  • 32-Channel ADC Object
  • Tetris
  • Video Hardware with Character Map Demo (Intro to Using Video 1 of 3)
  • WS2811, WS2812, WS2812b, WS2813, SK6812x NeoPixel Object
View Categories
  • Home
  • Docs
  • Quick Bytes
  • Propeller 2
  • Configuring Visual Studio Code for Programming the P2 on Mac, Windows, and Linux

Configuring Visual Studio Code for Programming the P2 on Mac, Windows, and Linux

Reading Time: 9 min read

Description #

This Quick Byte details the setup to configure Visual Studio Code (VSC) to program the Propeller 2 (the P2, or P2X8C4M64P) on Windows. The process for Mac, RaspPi, and Linux operating systems is similar and not detailed in this post – but the differences are shown on Stephen Moraco’s “Iron Sheep” GitHub (link at bottom).

VSC with the Spin2 extension provides syntax highlighting and compiling/downloading to a Propeller via add-in compilers with the familiarity of a very popular programming environment. 

The software required includes Microsoft VSC, the Spin2 extension (Stephen Moraco’s Iron Sheep Software), and the PNut software (Windows only; Parallax Inc.) or the FlexProp software (Mac, Linux and RaspPi; Total Spectrum Software).  All software is open source, freely available, and easily configured to compile and download to the P2.  Additionally, an ANSI-compliant terminal program of your choice (Parallax Serial Terminal, TerraTerm, CoolTerm, etc) may also be used for serial debug.  You will also have access to other VSC Marketplace extensions [like Error Lens, one of my favorites].

These instructions are for configuring the P2 with VSC under Windows.  You can obtain more specific instructions for all supported operating systems from Stephen Moraco’s “Iron Sheep” GitHub.  

Note: the bottom of this document includes a summary of links to important resources. 

Thank You to the Contributors

The P2 open source community is motivated by user feedback from the Parallax forums, the Propeller 2 Live Forums and messages of appreciation. If you benefit from this Quick Byte, we encourage you to join Parallax and also recognize their contributions through their Patreon accounts:

  • Eric Smith, Total Spectrum Software
  • Stephen Moraco, Iron Sheep Software
  • Cluso99 on the Parallax forums

Considerations Between PNut (Parallax) and FlexSpin (Total Spectrum Software) Compilers

PNut is the official Parallax compiler and was written in X86 assembly for use in the Propeller Tool for Windows.  FlexSpin is the compiler created by Eric Smith of Total Spectrum Software, written in C.  While efforts are made to ensure Parallax-published Quick Byte examples run in both compilers and that FlexSpin remains largely compatible, there are likely to be some small differences.  PNut includes the graphical debug tools (`debug) and FlexSpin does not.  Both compilers support Spin2 and PASM languages, but FlexSpin supports the mixing of objects with BASIC and C, along with some Propeller 1 (P1, or P8X32A) Spin 1 code. 

Details about FlexSpin are available on the Parallax forums FlexProp thread, and details about PNut are on the PNut thread. The PNut Tool is just a test-area for compiler changes before the compiler makes its way into the Propeller Tool for Windows, the official Parallax tool.

If you encounter compilation issues with FlexSpin, you can report them on the FlexProp thread or to the Total Spectrum Software GitHub. 

Step 0: Download and Install VSC + Unzip PNut or FlexProp 

  1. Download Visual Studio Code for your operating system
  2. Install VSC; all the default options are appropriate

–AND–

  1. Download PNut from the P2 PNut Releases page  
  2. Extract the zip into a folder of your choice; we recommend: C:\Programs\PNut

–or–

  1. Download FlexProp from the Total Spectrum Software Patreon page
  2. Extract the zip into a folder of your choice; we recommend: C:\Programs\FlexProp

NOTE: Neither PNut nor FlexProp have installers, so extracting into a proper folder is needed.  Creating a “Programs” folder is a suggestion that may avoid user permission issues associated with the “Program Files” folder.

PNut and FlexProp Download Pages

Step 1: Launch VSC, Install the Spin2 Extension

  1. Run the VSC software
  2. Click on the Extensions icon (Ctrl+Shift+X) and type “Spin2” in the search box
  3. Click the “Install” button to add the Spin2 extension, then select Set Color Theme and choose “Spin2 Ironsheep Dark”

Step 2: Setup Tasks

Visual Studio Code uses a JSON format file (tasks.json) to add compile and download functionality for the Propeller 2.  To update your tasks.json file:

  1. Type Ctrl+Shift+P  then type “tasks” and select the “Tasks: Open User Tasks” item in the results list
    • If prompted for a Task Template, select Others
    • The tasks.json file should open in the editor – it may contain something similar to the first five lines in the example below
  2. Copy the entire example below and paste it into the editor, completely replacing the current contents of tasks.json
  3. Select File > Save and close the tasks.json editor tab
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "compileP2",
      "type": "shell",
      "osx": {
        "command": "/Applications/flexprop/bin/flexspin.mac"
      },
      "windows": {
        "command": "flexspin.exe"
      },
      "linux": {
        "command": "/opt/flexprop/bin/flexspin"
      },
      "args": ["-2", "-Wabs-paths", "-Wmax-errors=99", "${fileBasename}"],
      "problemMatcher": {
        "owner": "Spin2",
        "fileLocation": ["autoDetect", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(.*):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      },
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "build",
        "isDefault": true
      }
    },
    {
      "label": "compileTopP2",
      "type": "shell",
      "osx": {
        "command": "/Applications/flexprop/bin/flexspin.mac"
      },
      "windows": {
        "command": "flexspin.exe"
      },
      "linux": {
        "command": "/opt/flexprop/bin/flexspin"
      },
      "args": ["-2", "-Wabs-paths", "-Wmax-errors=99", "${config:topLevel}.spin2"],
      "problemMatcher": {
        "owner": "Spin2",
        "fileLocation": ["autoDetect", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(.*):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      },
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "build",
        "isDefault": true
      }
    },
    {
      "label": "downloadP2",
      "type": "shell",
      "osx": {
        "command": "/Applications/flexprop/bin/loadp2.mac",
        "args": ["-b230400", "${config:topLevel}.binary", "-t"]
      },
      "windows": {
        "command": "loadp2.exe",
        "args": ["-b230400", "${config:topLevel}.binary", "-t"]
      },
      "linux": {
        "command": "/opt/flexprop/bin/loadp2",
        "args": ["-b230400", "${config:topLevel}.binary", "-t", "-p/dev/ttyUSB0"]
      },
      "problemMatcher": [],
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "test",
        "isDefault": true
      },
      "dependsOn": ["compileTopP2"]
    },
    {
      "label": "flashP2",
      "type": "shell",
      "osx": {
        "command": "/Applications/flexprop/bin/loadp2.mac",
        "args": ["-b230400", "@0=/Applications/flexprop/board/P2ES_flashloader.bin,@8000+${config:topLevel}.binary", "-t", "-k"]
      },
      "windows": {
        "command": "loadp2.exe",
        "args": ["-b230400", "@0=${env:FlexPropPath}/board/P2ES_flashloader.bin,@8000+${config:topLevel}.binary", "-t", "-k"]
      },
      "linux": {
        "command": "/opt/flexprop/bin/loadp2",
        "args": ["-b230400", "@0=/opt/flexprop/board/P2ES_flashloader.bin,@8000+${config:topLevel}.binary", "-t", "-p/dev/ttyUSB0"]
      },
      "problemMatcher": [],
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "test",
        "isDefault": true
      },
      "dependsOn": ["compileTopP2"]
    },
    {
      "label": "compilePNut2",
      "type": "shell",
      "command": "echo",
      "args": ["Avail on  windows only!"],
      "windows": {
        "command": "pnut_shell.bat",
        "args": ["${fileBasename}", "-c"]
      },
      "problemMatcher": {
        "owner": "Spin2",
        "fileLocation": ["autoDetect", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(.*):(\\d+):\\s*(warning|error):\\s*(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      },
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "build",
        "isDefault": true
      }
    },
    {
      "label": "compileTopPNut2",
      "type": "shell",
      "command": "echo",
      "args": ["Avail on  windows only!"],
      "windows": {
        "command": "pnut_shell.bat",
        "args": ["${config:topLevel}.spin2", "-c"]
      },
      "problemMatcher": {
        "owner": "Spin2",
        "fileLocation": ["autoDetect", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(.*):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      },
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "build",
        "isDefault": true
      }
    },
    {
      "label": "downloadPNut2",
      "type": "shell",
      "command": "echo",
      "args": ["Avail on  windows only!"],
      "windows": {
        "command": "pnut_shell.bat",
        "args": ["${config:topLevel}.spin2", "-r"]
      },
      "problemMatcher": {
        "owner": "Spin2",
        "fileLocation": ["autoDetect", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(.*):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      },
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "test",
        "isDefault": true
      }
    },
    {
      "label": "downloadDebugPNut2",
      "type": "shell",
      "command": "echo",
      "args": ["Avail on  windows only!"],
      "windows": {
        "command": "pnut_shell.bat",
        "args": ["${config:topLevel}.spin2", "-rd"]
      },
      "problemMatcher": {
        "owner": "Spin2",
        "fileLocation": ["autoDetect", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(.*):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      },
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "test",
        "isDefault": true
      }
    },
    {
      "label": "flashPNut2",
      "type": "shell",
      "command": "echo",
      "args": ["Avail on  windows only!"],
      "windows": {
        "command": "pnut_shell.bat",
        "args": ["${config:topLevel}.spin2", "-f"]
      },
      "problemMatcher": {
        "owner": "Spin2",
        "fileLocation": ["autoDetect", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^(.*):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "severity": 3,
          "message": 4
        }
      },
      "presentation": {
        "panel": "dedicated",
        "focus": false,
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "test",
        "isDefault": true
      }
    }
  ]
}

Step 3: Setup Path for your P2 Compiler of Choice in Windows 

For VSC Tasks to activate the tools properly, you need to set your Windows “Path” Environment Variable to point to them. 

  1. Open Windows Explorer and navigate to the folder where you extracted the PNut software, or to the “bin” subfolder within the folder where you extracted the FlexProp software
  2. Copy the path in the URL field
  3. Click on the Windows Start button, type “environment” and select “Edit the system environment variables“
  4. On the System Properties window click the Environment Variables… button
  5. Double-click the Path item in the System variables section, click the New… button, and paste the path you copied earlier
  6. Click the OK button
  7. Back on the Environment Variables window, click the New… button in the System variables section to create a new variable
  8. In the “Variable name:” field, type “PNutPath” or “FlexPropPath” (depending on the tool you installed), paste the path into the “Variable value:” field, and click the OK button
  9. Click the OK button on the remaining windows to finalize the changes
  10. IMPORTANT: Close and restart VSC for the Path change to be recognized

Step 4: Key Bindings

To compile and download to the P2, you’ll need to update VSC’s key bindings JSON file to provide the following functionality:

  • Compile – Compile current file [ctrl-shift-B], [F8]
  • Compile Top – Compile the top-file of this project
  • Download – Download the binary to RAM in our connected P2 [ctrl+shift+d] or [F10]
  • Download & Debug – [w/PNut only] Download the binary to RAM in our connected P2 [ctrl+F10]
  • Flash – Download and write the binary to FLASH in our connected P2 [ctrl+shift+f] or [F11]

To update your keybindings.json file:

  1. Type Ctrl+Shift+P (Cmd+Shift+P on mac) then type “keyboard” and select the “Preferences: Open Keyboard Shortcuts (JSON)” item in the results list
    • The file should open in the editor and may contain something similar to the first two lines in the example below
  2. Copy the entire example below and paste it into the editor, completely replacing the current contents of keybindings.json
    • Or carefully insert changes as-needed to preserve any existing key bindings you may have
  3. Select File > Save and close the keybindings.json editor tab
PNut Key Bindings #
FlexProp Key Bindings #
// Place your key bindings in this file to override the defaultsauto[]
// PNut compiler key bindings
[
  {
    "key": "ctrl+shift+d",
    "command": "workbench.action.tasks.runTask",
    "args": "downloadPNut2"
  },
  {
    "key": "ctrl+shift+f",
    "command": "workbench.action.tasks.runTask",
    "args": "flashPNut2"
  },
  {
    "key": "F8",
    "command": "workbench.action.tasks.build",
    "args": "compilePNut2"
  },
  {
    "key": "F10",
    "command": "workbench.action.tasks.runTask",
    "args": "downloadPNut2"
  },
  {
    "key": "ctrl+F10",
    "command": "workbench.action.tasks.runTask",
    "args": "downloadDebugPNut2"
  },
  {
    "key": "F11",
    "command": "workbench.action.tasks.runTask",
    "args": "flashPNut2"
  }
]
// Place your key bindings in this file to override the defaultsauto[]
// FlexProp compiler key bindings
[
  {
    "key": "ctrl+shift+d",
    "command": "workbench.action.tasks.runTask",
    "args": "downloadP2"
  },
  {
    "key": "ctrl+shift+f",
    "command": "workbench.action.tasks.runTask",
    "args": "flashP2"
  },
  {
    "key": "F8",
    "command": "workbench.action.tasks.build",
    "args": "compileP2"
  },
  {
    "key": "F10",
    "command": "workbench.action.tasks.runTask",
    "args": "downloadP2"
  },
  {
    "key": "F11",
    "command": "workbench.action.tasks.runTask",
    "args": "flashP2"
  }
]

Step 5: Configure settings.json to Identify your Top P2 File (per project)

The compiler needs to know the name of your Spin2 Top File for your project (for multi-object projects).

For each new project you create:

  1. Create a new subfolder in your project folder, named “.vscode“
  2. Create a new file within the .vscode subfolder, named “settings.json“
  3. Copy and paste the following template into a new file
  4. Replace the your_top_file text with the name of your project’s top Spin2 file (without the extension)
  5. Select File > Save and close the settings.json editor tab
{
    "topLevel": "your_top_file",
 }

Write Code, Compile and Download to the P2!

Using the keymappings identified above, F8 will compile (only), and F10 or F11 compile and download to RAM or Flash, respectively.   Close the terminal window after downloads are finished. 

Remember: For Each New Project, Create a .vscode/settings.json Subfolder and File

Every time you begin a new P2 project with VSC, repeat the last step above so VSC knows what source file to start compiling your multi-object project from. 

Parts Used #
  • P2 Edge Module
  • P2 Edge Breadboard
Source Code #
  • Any source code!
Programming Language #
  • Spin 2
  • PASM2
  • BASIC (see FlexProp Help for FlexBASIC Language Reference)
  • C (see FlexProp Help for C Language Reference)
Tools and Operating System #
  • FlexProp for Windows, Mac and Linux
  • Visual Studio Code (Microsoft)
Additional Resources #
  • FlexProp Presentation by Eric Smith, Total Spectrum Software (YouTube Video)
  • FlexProp: a Complete Programming System for P1 and P2 (Parallax Forums)
  • Iron Sheep VSC Support (GitHub)
Document Author #
  • Ken Gracey
Source Code Author #
  • Eric Smith, Stephen Moraco, Cluso99
Was this useful ?

Share This Article :

  • Facebook
  • X
  • LinkedIn
Still stuck? How can we help?

Still stuck? How can we help?

Updated on September 27, 2026
WS2811, WS2812, WS2812b, WS2813, SK6812x NeoPixel ObjectBreakout Board Options for P2 Edge Modules
Table of Contents
  • Description
    • PNut Key Bindings
    • FlexProp Key Bindings
  • Parts Used
  • Source Code
  • Programming Language
  • Tools and Operating System
  • Additional Resources
  • Document Author
  • Source Code Author

Copyright © 2026 - Parallax Inc.
599 Menlo Drive | Rocklin, CA 95765 | USA