| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| en:iot:examples:setup:usb [2018/01/23 14:49] – Somepub | en:iot:examples:setup:usb [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 |
|---|
| ====== USB ====== | ====== Installing Atom with PlatformIO and creating your first project ====== |
| | |
| There are many different ways to install PlatformIO. | |
| | |
| **Sources:** | |
| |
| | **Source:** |
| http://docs.platformio.org/en/latest/ide/atom.html#installation | http://docs.platformio.org/en/latest/ide/atom.html#installation |
| |
| http://docs.platformio.org/en/latest/installation.html | This tutorial describes how to download and install PlatformIO as an Atom plugin. |
| | |
| http://www.whatimade.today/esp8266-easiest-way-to-program-so-far/ | |
| | |
| | |
| The next tutorial describes how to download and install PlatformIO as an Atom plugin. | |
| |
| === Installation === | === 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) |
| - [[https://atom.io/|Download]] and install official GitHub’s Atom text editor. PlatformIO IDE is built on top of it | |
| - Open Atom Package Manager (Linux,OS -> Menu: Edit > Preferences > Install, Windows -> Menu: File > Settings > Install) | - Open Atom Package Manager (Linux,OS -> Menu: Edit > Preferences > Install, Windows -> Menu: File > Settings > Install) |
| - Search for official Platformio-ide package | - Search for official Platformio-ide package |
| {{:en:iot:examples:ide-atom-pkg-installer.png?300|}} | - {{:en:iot:examples:ide-atom-pkg-installer.png?400|}} |
| - Install PlatformIO IDE | - Install PlatformIO IDE |
| - Intall clang | - Install clang |
| * Linux: Using package managers: apt-get install clang or yum 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 are installed automatically when you run clang in Terminal for the first time, or manually by running <code c> xcode-select --install </code> | * 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 <code c> xcode-select --install </code> |
| * 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. | * 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-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)]] | * [[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. |
| | |
| |
| |
| |
| - Click on “PlatformIO Home” button on the PlatformIO Toolbar | * Click on “PlatformIO Home” button on the PlatformIO Toolbar |
| {{:en:iot:examples:ide-atom-welcome.png?300|}} | {{:en:iot:examples:ide-atom-welcome.png?300|}} |
| - Click on “New Project”, select a board and create new PlatformIO Project | * Click on “New Project” |
| {{:en:iot:examples:ide-atom-new-project.png?300|}} | {{:en:iot:examples:setup:platformio.png?400|}} |
| - Open platformio.ini file and paste <code c>lib_deps = ITTIoT, EmonLib, Adafruit NeoPixel, Encoder, Adafruit GFX, Library,DHT sensor library, Adafruit Unified Sensor </code> to the end of the framework line | * Choose a name for your project. In board selection choose "WeMos D1 R2 & mini (WEMOS)" and the framework should be "Arduino". |
| - Open main.cpp file form src folder and replace its contents with some code | {{:en:iot:examples:setup:newproject.png?300|}} |
| - Run Build (PlatformIO > Build) and you should see green “success” result in the building panel | * On the left menu add the project you just created to the Project tree |
| | * Open platformio.ini file and paste <code c>lib_deps = ITTIoT</code> 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 <code c>board = d1_mini</code> |
| | <note important>Image needs to be replaced</note> |
| | {{: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|}} | {{:en:iot:examples:ide-atom-process-project.png?300|}} |
| - To upload firmware to the board run Upload | * 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. |
| - What is more, you can run specific target or process project environment using (Menu: PlatformIO > Run other target...) or call targets list from the status bar (bottom, left corner) | (If you are having uploading problems with Linux, try sudo chown username /dev/ttyUSB0) |
| (If your having uploading problems with Linux, try sudo chown username /dev/ttyUSB0) | |
| |
| {{:en:iot:examples:ide-atom-quick-start-11.png?300|}} | * To run built-in “Serial Monitor” choose (Menu: PlatformIO > Serial Monitor) or press the corresponding icon in the PlatformIO toolbar |
| - To run built-in terminal interface choose (Menu: PlatformIO > Terminal) or press the corresponding icon in the PlatformIO toolbar | |
| {{:en:iot:examples:ide-atom-quick-start-13.png?300|}} | {{:en:iot:examples:ide-atom-quick-start-13.png?300|}} |
| - To run built-in “Serial Monitor” choose (Menu: PlatformIO > Serial Monitor) or press the corresponding icon in the PlatformIO toolbar | |
| |
| |
| **Link for installation: | |
| http://docs.platformio.org/en/latest/ide/atom.html#installation** | |