PlatformIO code compiles but fails to execute when uploaded


This is a really silly one but it tripped me up for far longer than I care to admit. In essence, the issues I was having is that I would successfully compile and upload my code in PlatformIO but for some reason it wouldn’t execute on the device. I tried many, many things, including a complete re-install of the environment to no avail.

The issue was that I was placing my code file at the root of the project file structure (where the red X is above) and not in the SRC directory (where the green tick is above). Thus, when I created a new project using PlatformIO, it created a new empty main.cpp in the SRC directory and was actually compiling that and uploaded that to my device. Because this default template effectively did nothing, the device looked as though it wasn’t working.

Without knowing this, I had create my code in a file, also called main.cpp, but at the root of the project structure that was never being compiled and uploaded! D’Oh!

Once I had my code in the main.cpp file in the SRC directory, it uploaded and executed on the device as expected. I probably should have read the PlatformIO documentation first:

PlatformIO IDE for VSCode

alas, I didn’t and thereby wasted hours trying to work out what was wrong! I’m glad that I’ve now worked it out and I’m sharing just in case someone else has the same issue, as I did spend heaps of time searching for a solution and found none that pointed out my error of file location.

Need to Know podcast–Episode 201

We’ve recovered from our 200th episode and are getting back into the swing of our regular programming with some updates, information and opinions from the Microsoft Cloud. We cover some recent important updates, especially in the area of security, as well as some news around Microsoft 365 and Azure. We also dip our toes quickly into the area of certifications but we’ll need more time to do justice to the topic. So stay tuned for that episode coming real soon. For now, sit back and enjoy as we get back to what we like doing – keeping you up to date with everything that’s happening in the Microsoft Cloud.

Take a listen and let us know what you think –

You can listen directly to this episode at:

Subscribe via iTunes at:

The podcast is also available on Stitcher at:

Don’t forget to give the show a rating as well as send us any feedback or suggestions you may have for the show.




CIAOPS Patron Program

Microsoft Cloud outage information

Duplicating a Microsoft Planner plan using PowerShell

GitHub and free access to private repositories

Office 365 will automatically block Flash and Silverlight

Azure AD makes sharing and collaboration seamless for any user account

Microsoft’s Cyber defense Operations Center shares best practices

Step 3 – Protect your identities. Top 10 actions to secure your environment

Get ready for the new Microsoft 365 Security Center and Microsoft 365 Compliance Center

Microsoft 365 NIST 800-53 action plan