Onboarding tips (VS Code) and issues

It appears that I’m late to the party as I recently discovered Arduboy. I wish I learned of this neat little device while I was waiting for my PlayDate to arrive.

Anyway, I recently set up my development environment and I thought I’d share my workflow as well as issues I have run into. Since I don’t have a physical Arduboy yet I have been using the ProjectABE emulator. Although the emulator provides a code editor, I’d prefer to stick with my typical IDE, VS Code (especially as it supports a VIM plugin).

To work with VS Code, you need to install the Arduino extension provided by Microsoft. You then need to install the Arduino IDE. Unfortunately the extension does not yet support version 2.0 of the Arduino IDE so make sure you install a previous version. I wasted quite a bit of time trying to get this to work

In the Arduino IDE, make sure you install the recommended libraries like Arduboy2, see this guide. Unfortunately I was not able to create a board management configuration for Arduboy as https://arduboy.github.io/board-support/package_arduboy_index.json appears to be dead. Nonetheless, this is not an issue. In the VS Code Arduino extension you’ll simply need to select the Leonardo board.

Now to configure your project in VS Code, make sure you have an arduino.json at the root of your project. This file will contain your selected board, e.g. "board": "arduino:avr:leonardo". This file also needs to contain an output configuration, e.g. "output" = "build". Otherwise, the VS Code extension will build to a tmp directory and immediately remove it upon a successful build (odd default behavior).

Now for the workflow, you can create a build by running Arduino: Verify. This will create a .hex file in your configured output location. Finally you can run the file on the emulator with the command ~/ProjectABE/ProjectABE build/GameName.ino.hex. I tried to configure this command to run as a post build script through the Arduino VS Code extension but I was getting a screen error. I’m developing on a Chromebook so others may have better luck. On a side note, I wish the emulator remembered the window location as I have to resize it every time it’s launched.

And that’s it! Now I can develop on the emulator using my preferred IDE, VS Code, along with all of my plugins and great intellisense support.

(I would have provided more links above but I guess new users to this forum are limited to only 2)


This should be buit automatically when you select an .ino file

Mine shows the selected board, etc.

If I click on the Board Configuration (in my case where it says ‘Arduboy (FX)’, it reveals the ‘Arduino Board Configuration’ panel. Allowing you to configure these parameters.

Are you getting the same?

Does the tmp folder get deleted when you build rather than verify?

My tip here is to build into a directory that is not part of your project path as it mucks up searching. When you build into the same path and search for text within your code, you will often get two results - one in the source and one in the build. This can be confusing and can result in you editing copies of the original source in the build directory.

"output" : "C:/Temp/Build" 

@bateske recently reached out to me to help him fix this but he hasn’t responded to my reply.

Yes. Although there is no default output configuration.

Does the tmp folder get deleted when you build rather than verify?

Is there a way to trigger a build beside verify? That’s the only way I know how to trigger one.

When you build into the same path and search for text within your code, you will often get two results - one in the source and one in the build.

Thanks for the tip. I think I read that recommendation somewhere else as well. I have it one level up in a build folder.

@bateske recently reached out to me to help him fix this but he hasn’t responded to my reply.

Am I missing something not having the “correct” board configuration?

No there isn’t. Shame really!

Ooops, I meant Upload. Ctrl-Shift-U on Windows maybe? (I am on a Mac).

Ooops, I meant Upload. Ctrl-Shift-U on Windows maybe? (I am on a Mac).

It might not get deleted but I don’t have a physical device yet so upload doesn’t make sense. I’m on a Chromebook which is effectively Linux (through Crostini).

1 Like

Not really. The binaries will be a couple of bytes larger because the board name is embedded somewhere in them and Arduboy is shorter than Leonardo.

Until it’s properly fixed, I have a repo that hosts a back-up copy:

That should be "output": "build" (:, not =), though the "build" can be any valid directory name.

To be honest, I rarely bother with this unless I actually need a copy of the .hex file. It might speed build times up perhaps, or reduce wear on the storage device, but usually I don’t find that to be much of an issue. VSCode/VSCodium has an ‘upload’ button that uploads immediately after building, before the folder is wiped.

Though I suspect for Windows it might actually just put the file in the %TEMP% directory. I would have thought a Linux-based system would do the same, but apparently not?

(If I get time, I’ll double-check what it does for Windows.)

I think the intented way is to install the IDE first and then the Arduino extension, but if it works the other way around then the order possibly doesn’t matter.

That’s probably the case. You can always go back and edit them in later.

I’m still kind of in shock right now, but trying to get VS Code set up somehow deleted every single one of my sketches that I’ve been working on for years. All my artwork, assets, files, everything that I’ve saved in the Arduino folder. It didn’t ask me to confirm this, I had no idea what caused it. But it’s not like it moved anything to the trash, it just completely deleted everything. I’m so mad. Does anyone know of any way to recover these files?

I found out that it is VS code doing this. Just opening VS Code would run Arduino IDE, which would proceed to wipe all the files from the /Documents/Arduino folder. Incredible.

That’s really weird, and I’ve never heard of this happening before.

It could be that it’s been misconfigured somehow.

Recovery software does exist, but I have no particular recommendations.

If you’re on Win10 you could try this.
Alternatively you could try the things mentioned here.

Either way the longer you leave it the less chance there will be of recovery.

Normally deleting just disconnects the files from the file system and they won’t be overwritten so they can still be recovered, but as time goes by the chance of them being overwritten by the creation of new files or extension of old ones increases.

Yeah I’ve just accepted the fact that they’re gone. I haven’t backed up my computer since February 2022 either, but I can at least recover them from there. I just wanted to use VS Code instead of the annoying Arduino IDE (the new and old ones both bother me) but I’ll just be doing that I guess.

Like I said before, I’ve never heard of VS Code doing this and it certainly never happened to me, so unless it’s a bug with a more recent version I suspect something was misconfigured somewhere.

The damage is done now, so as long as you back up what you’ve managed to recover elsewhere then there’s no harm in investigating the problem and trying to get it working properly.

You’re right, I took that advice and played around with it some more. It looks like the problem was the "output": "../" command I was using in the arduino.json file. I was trying to tell it to build it in a folder one up from the root, but that was obviously a mistake. I changed it to just the recommended "output": "build" and it seems to work okay. It still has a strange behavior of running the Verify command every time I start up VS Code though. I checked the Arduino extension settings and didn’t see anything telling it to do that, so I’m not sure about that one. Edit: Found it in the settings actually. First checkbox.

Ah. I’m guessing your project was directly under the Arduino directory?

In which case you basically told it to build in `/Arduino/Project/…/", which is of course the same as “/Arduino/”. Ergo it wiped the whole Arduino directory in preparation as part of the ‘clean’ step before the initial build. In which case: mystery solved.

The tragic thing is that if you’d had even one valid character after that slash (e.g. ../a) you would have been fine because it would have been in a new directory under the Arduino folder.

It didn’t always do that, that became the default behaviour at some point. (Quite when I’m not sure.)


Yeah, that would do it. Just another lesson learned the hard way.

So sorry for you. It’s a hard lesson re. backups; one I’m sure we’ve all experienced. May I recommend you also have a look at Backblaze - it’s been fantastic for me.

1 Like

I use GitHub as a backup solution for code. I save anything of value in a private repo.

I think @raspberrybrain is using a Mac rather than Windows. There is a free, open-source file ‘undelete’ tool called TestDisk that I have seen in use but never used myself. It is a command line tool so a little awkward but its free.


Thank you all for the advice. I was able to get it up and working, so really the worst thing I had to do was a few hours of redoing some art. It still ended up being positive in the end, since now I can use VS Code and actually edit any type of file in the same code editor. Much better than using Arduino IDE for the C++, Atom for the JSON and txt files, etc.