Platformio and Pico W - cannot upload

I installed the firmware and got the built in LED flashing using Thonny, so I know that the Pico W works.

But I can’t get even a “Hello World” program running using VS Code and Platformio. It fails to upload with error 1.

Can anyone give a link to a good tutorial to get Code, Platformio and Pico W working? Writing the code isn’t a problem, the setup seems to be

I am not using Platformio for this, but VSC native. I use a tasks.json in my project like this:

{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
     {
         "label": "Copy to Pico",
         "type": "process",
         "problemMatcher": [],
         "options": {
             "cwd": "${workspaceFolder}"
         },
         "command": "openocd",
         "args": [
             "-f",
             "interface/raspberrypi-swd.cfg",
             "-f",
             "target/rp2040.cfg",
             "-c",
             "program ${command:cmake.launchTargetPath} verify reset exit"
         ],
         "group": "none",
         "presentation": {
             "echo": true,
             "reveal": "always",
             "focus": false,
             "panel": "shared",
             "showReuseMessage": false,
             "clear": false
         },
     }
 ]
}

Thanks for your suggestion. I have used platformio in the past and found the environment quite helpful. Although I may change my mind in the future, I’ll be sticking with it for now…

For anybody else with this issue of not finding the device to upload to on Ubuntu. It seems that I had a problem that a previous installation of platformio was being picked up. Which gave some unpredictable results (unsurprisingly).

In a treminal I ran
pio device list
And got no results (despite the pico w being plugged in)

I then did
pip install -U platformio
(get a wall of friendly and happy status messages)

And I now get
pio device list
Please wait while upgrading PlatformIO…
PlatformIO has been successfully upgraded to 6.1.6a3!

/dev/ttyACM0

Hardware ID: USB VID:PID=2E8A:00C0 SER=xxxxxxxxxxxxxxxx LOCATION=3-2:1.0
Description: RaspberryPi Pico

And I can now upload my code.