Merge pull request #176 from valeros/develop
Add examples with preconfigured IDE projects // Resolve #154
BIN
docs/_static/ide-platformio-qtcreator-1.png
vendored
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
docs/_static/ide-platformio-qtcreator-2.png
vendored
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
docs/_static/ide-platformio-qtcreator-3.png
vendored
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
docs/_static/ide-platformio-qtcreator-4.png
vendored
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
docs/_static/ide-platformio-qtcreator-5.png
vendored
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
docs/_static/ide-platformio-qtcreator-6.png
vendored
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
docs/_static/ide-platformio-qtcreator-7.png
vendored
Normal file
After Width: | Height: | Size: 100 KiB |
@ -9,6 +9,7 @@ IDE Integration
|
||||
ide/arduino
|
||||
ide/eclipse
|
||||
ide/energia
|
||||
ide/qtcreator
|
||||
ide/sublimetext
|
||||
ide/vim
|
||||
ide/visualstudio
|
||||
|
113
docs/ide/qtcreator.rst
Normal file
@ -0,0 +1,113 @@
|
||||
.. _ide_qtcreator:
|
||||
|
||||
Qt Creator
|
||||
==========
|
||||
|
||||
The `Qt Creator <https://github.com/qtproject/qt-creator>`_ is an open source cross-platform integrated development environment. The editor includes such features as syntax highlighting for various languages, project manager, integrated version control systems, rapid code navigation tools and code autocompletion.
|
||||
|
||||
This software can be used with:
|
||||
|
||||
* all availalbe :ref:`platforms`
|
||||
* all availalbe :ref:`frameworks`
|
||||
|
||||
Refer to the `Sublime Text Documentation <http://doc.qt.io/qtcreator/>`_
|
||||
page for more detailed information.
|
||||
|
||||
.. contents::
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Setup New Project
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
First of all, let's create new project from Qt Creator Start Page: ``New Project`` or using ``Menu: File → New File or Project``, then select project with ``Empty Qt Project`` type (``Other Project → Empty Qt Project``), fill ``Name``, ``Create in``.
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-1.png
|
||||
|
||||
On the next steps select any available kit and click Finish button.
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-2.png
|
||||
|
||||
Secondly, we need to configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut):
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-3.png
|
||||
|
||||
Thirdly, we need to add directories with header files using project file. Please fill this file with the next contents:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
win32 {
|
||||
HOMEDIR += $$(USERPROFILE)
|
||||
}
|
||||
else {
|
||||
HOMEDIR += $$(PWD)
|
||||
}
|
||||
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino"
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include"
|
||||
|
||||
win32:INCLUDEPATH ~= s,/,\\,g
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-4.png
|
||||
|
||||
First program in Qt Creator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Simple "Blink" project will consist from two files:
|
||||
|
||||
1. Main "C" source file named ``main.c`` must be located in the ``src`` directory.
|
||||
Let's create new text file named ``main.c`` using ``Menu: New File or Project → General → Text File``:
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-5.png
|
||||
|
||||
Copy the source code which is described below to file ``main.c``.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#include "Arduino.h"
|
||||
#define WLED 13 // Most Arduino boards already have an LED attached to pin 13 on the board itself
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(WLED, OUTPUT); // set pin as output
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
digitalWrite(WLED, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(WLED, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
||||
|
||||
2. Project Configuration File named ``platformio.ini`` must be located in the project root directory.
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-6.png
|
||||
|
||||
Copy the source code which is described below to it.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
[env:arduino_uno]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = uno
|
||||
|
||||
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build → Build All``:
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-7.png
|
23
examples/ide/qtcreator/platformio.ini
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
# Simple and base environment
|
||||
# [env:mybaseenv]
|
||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||
# framework =
|
||||
# board =
|
||||
#
|
||||
# Automatic targets - enable auto-uploading
|
||||
# targets = upload
|
||||
|
||||
[env:arduino_uno]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = uno
|
19
examples/ide/qtcreator/platformio.pro
Normal file
@ -0,0 +1,19 @@
|
||||
win32 {
|
||||
HOMEDIR += $$(USERPROFILE)
|
||||
}
|
||||
else {
|
||||
HOMEDIR += $$(PWD)
|
||||
}
|
||||
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino"
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include"
|
||||
|
||||
win32:INCLUDEPATH ~= s,/,\\,g
|
||||
|
||||
# DEFINES += __AVR_ATmega328__
|
||||
|
||||
OTHER_FILES += \
|
||||
platformio.ini
|
||||
|
||||
SOURCES += \
|
||||
src/main.c
|
25
examples/ide/qtcreator/src/main.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include "Arduino.h"
|
||||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
||||
|
||||
// the setup routine runs once when you press reset:
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
pinMode(led, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever:
|
||||
void loop() {
|
||||
digitalWrite(led, HIGH);
|
||||
delay(1000);
|
||||
digitalWrite(led, LOW);
|
||||
delay(1000);
|
||||
}
|
||||
|
23
examples/ide/sublime-text/platformio.ini
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
# Simple and base environment
|
||||
# [env:mybaseenv]
|
||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||
# framework =
|
||||
# board =
|
||||
#
|
||||
# Automatic targets - enable auto-uploading
|
||||
# targets = upload
|
||||
|
||||
[env:flora8]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = flora8
|
43
examples/ide/sublime-text/platformio.sublime-project
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"build_systems":
|
||||
[
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"run"
|
||||
],
|
||||
"name": "PlatformIO",
|
||||
"variants":
|
||||
[
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"run",
|
||||
"-t",
|
||||
"clean"
|
||||
],
|
||||
"name": "Clean"
|
||||
},
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"run",
|
||||
"-t",
|
||||
"upload"
|
||||
],
|
||||
"name": "Upload"
|
||||
}
|
||||
],
|
||||
"working_dir": "${project_path:${folder}}"
|
||||
}
|
||||
],
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
]
|
||||
}
|
24
examples/ide/sublime-text/src/Blink.pde
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
||||
|
||||
// the setup routine runs once when you press reset:
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
pinMode(led, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever:
|
||||
void loop() {
|
||||
digitalWrite(led, HIGH);
|
||||
delay(1000);
|
||||
digitalWrite(led, LOW);
|
||||
delay(1000);
|
||||
}
|
||||
|
62
examples/ide/visual-studio/blink.vcxproj
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0FA9C3A8-452B-41EF-A418-9102B170F49F}</ProjectGuid>
|
||||
<Keyword>MakeFileProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>platformio run -t clean</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<NMakeIncludeSearchPath>$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>platformio run -t clean</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<NMakeIncludeSearchPath>$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="readme.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="platformio.ini" />
|
||||
<None Include="src\blink.pde" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
29
examples/ide/visual-studio/blink.vcxproj.filters
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\src">
|
||||
<UniqueIdentifier>{cad450ef-1a84-42d4-a5b5-a1736b8833d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="readme.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="platformio.ini" />
|
||||
<None Include="src\blink.pde">
|
||||
<Filter>Source Files\src</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
23
examples/ide/visual-studio/platformio.ini
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
# Simple and base environment
|
||||
# [env:mybaseenv]
|
||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||
# framework =
|
||||
# board =
|
||||
#
|
||||
# Automatic targets - enable auto-uploading
|
||||
# targets = upload
|
||||
|
||||
[env:arduino_uno]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = uno
|
24
examples/ide/visual-studio/src/blink.pde
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
||||
|
||||
// the setup routine runs once when you press reset:
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
pinMode(led, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever:
|
||||
void loop() {
|
||||
digitalWrite(led, HIGH);
|
||||
delay(1000);
|
||||
digitalWrite(led, LOW);
|
||||
delay(1000);
|
||||
}
|
||||
|