Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to make an Arduino IDE project from a PlatformIO project


Your friends are comfortable in the Arduino IDE, but you using vscode and PlatformIO because it is easier (libraries, config and shortcuts). So you need to give them an ino file and the correct versions of the libraries. And you want to eliminate them from running an incorrect version the project.


Only tested on a Mac using zsh.

  1. Paste the into the root of your PlatformIO project. Give it execute permissions if needed chmod u+x
  2. Then adjust the script with the project name and any string replacements you need.
  3. Run it ./ and give it a version. This will put it in a folder called build and add a zipped version.
  4. Send this to the Arduino IDE friend.
  5. Uzip folder.
  6. Included in the project is a libs folder. This is to remove the issues with having to find the libraries and the correct versions through the Arduino IDE. You take the the contents of the libs folder and paste it into the Arduino IDE libraries folder, usually at Documents/Arduino/libraries
  7. Double click the my-project-name.ino and you should be good to go.

Hope it works for u. There is probably an easier way?

read -p "Enter version: " version
if [ -z "$version" ]
echo "Error please add a version"
echo "Make arduino ide version $version"
# can replace strings in your project like passwords or settings, this is an array can add more
stringReplacements=("s/string to be replaced/replacement string/g")
# makes a folder called build for the results of this script
mkdir build
# main program
mkdir build/$mainName
# copying your custom libraries to the output folder
cp ./lib/**/src/* build/$mainName
# copying the source files
cp ./src/* build/$mainName
# rename the main.cpp to ino so it opens in arduino ide
mv build/$mainName/main.cpp build/$mainName/$mainName.ino
# replacing any strings like passwords and things
for ((i = 0; i < ${#stringReplacements[@]}; i++))
sed -i '' "${stringReplacements[$i]}" build/$mainName/*.cpp build/$mainName/*.h build/$mainName/*.ino
# copy the libraries from pio folder to a libs folder (paste into the /Arduino/libraries folder)
mkdir -p build/$mainName/libs
cp -R ./.pio/libdeps/**/* build/$mainName/libs
# rename if there are spaces
for i in build/$mainName/libs/*
mv "$i" ${i// /_}
# copying your flash data folder to the output folder
mkdir -p build/$mainName/data
cp -R ./data/* build/$mainName/data
# zip it so you can send
zip -r build/$ build/$mainName
echo "Made build/$mainName"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment