====== Installing Atom with PlatformIO and creating your first project ====== **Source:** http://docs.platformio.org/en/latest/ide/atom.html#installation This tutorial describes how to download and install PlatformIO as an Atom plugin. === Installation === - [[https://atom.io/|Download]] and install official GitHub’s Atom text editor. PlatformIO will be installed as a plugin to it. Install Python if not yet installed (Windows) - Open Atom Package Manager (Linux,OS -> Menu: Edit > Preferences > Install, Windows -> Menu: File > Settings > Install) - Search for official Platformio-ide package - {{:en:iot:examples:ide-atom-pkg-installer.png?400|}} - Install PlatformIO IDE - Install clang * Linux: Using package managers: apt-get install clang or yum install clang. * Mac OS X: Install the latest Xcode along with the latest Command Line Tools (they have installed automatically when you run clang in Terminal for the first time, or manually by running xcode-select --install * Windows: [[http://releases.llvm.org/download.html|Download]] Clang 3.9.1 for Windows. Please select “Add LLVM to the system PATH” option on the installation step. * [[http://releases.llvm.org/3.9.1/LLVM-3.9.1-win32.exe|Clang 3.9.1 for Windows (32-bit)]]. * [[http://releases.llvm.org/3.9.1/LLVM-3.9.1-win64.exe|Clang 3.9.1 for Windows (64-bit)]] PLEASE DO NOT INSTALL CLANG 4.0. PLATFORMIO TEMPORARY SUPPORTS ONLY CLANG 3.9. If you see Failed to find MSBuild toolsets directory error in the installation console, please ignore it and press any key to close this window. PlatformIO IDE uses only Clang completion engine that should work after it without any problems. === Setting Up the Project === * Click on “PlatformIO Home” button on the PlatformIO Toolbar {{:en:iot:examples:ide-atom-welcome.png?300|}} * Click on “New Project” {{:en:iot:examples:setup:platformio.png?400|}} * Choose a name for your project. In board selection choose "WeMos D1 R2 & mini (WEMOS)" and the framework should be "Arduino". {{:en:iot:examples:setup:newproject.png?300|}} * On the left menu add the project you just created to the Project tree * Open platformio.ini file and paste lib_deps = ITTIoT to the end of the framework line. "lib_deps" informs the PlatformIO about which libraries to download for your project. ITTIoT library is a must-have with all IoT Homelab kit programs. The exact libraries needed for each module are described on their example page. Make sure that the board is correct board = d1_mini Image needs to be replaced {{:en:iot:examples:setup:2018-01-23.png?300|}} * Open main.cpp file in src folder. Here is where you will write your code. For now just replace everything with the [[en:iot:examples:relay|relay example code]]. {{:en:iot:examples:setup:maincpp.png?300|}} * Run Build (PlatformIO > Build) and you should see green “success” result in the building panel {{:en:iot:examples:ide-atom-process-project.png?300|}} * To upload firmware to the board run Upload. After you have successfully uploaded your code you might want to check how it works. To do that try sending it commands with the MQTTbox software. (If you are having uploading problems with Linux, try sudo chown username /dev/ttyUSB0) * To run built-in “Serial Monitor” choose (Menu: PlatformIO > Serial Monitor) or press the corresponding icon in the PlatformIO toolbar {{:en:iot:examples:ide-atom-quick-start-13.png?300|}}