diff --git a/docs/_static/ide-platformio-qtcreator-1.png b/docs/_static/ide-platformio-qtcreator-1.png new file mode 100644 index 00000000..1972daf8 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-1.png differ diff --git a/docs/_static/ide-platformio-qtcreator-2.png b/docs/_static/ide-platformio-qtcreator-2.png new file mode 100644 index 00000000..759b02ee Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-2.png differ diff --git a/docs/_static/ide-platformio-qtcreator-3.png b/docs/_static/ide-platformio-qtcreator-3.png new file mode 100644 index 00000000..9eba936b Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-3.png differ diff --git a/docs/_static/ide-platformio-qtcreator-4.png b/docs/_static/ide-platformio-qtcreator-4.png new file mode 100644 index 00000000..a3b044e1 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-4.png differ diff --git a/docs/_static/ide-platformio-qtcreator-5.png b/docs/_static/ide-platformio-qtcreator-5.png new file mode 100644 index 00000000..5e5cbea1 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-5.png differ diff --git a/docs/_static/ide-platformio-qtcreator-6.png b/docs/_static/ide-platformio-qtcreator-6.png new file mode 100644 index 00000000..c24c5526 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-6.png differ diff --git a/docs/_static/ide-platformio-qtcreator-7.png b/docs/_static/ide-platformio-qtcreator-7.png new file mode 100644 index 00000000..cdaf1f6f Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-7.png differ diff --git a/docs/ide.rst b/docs/ide.rst index ba74ee60..48053b78 100644 --- a/docs/ide.rst +++ b/docs/ide.rst @@ -9,6 +9,7 @@ IDE Integration ide/arduino ide/eclipse ide/energia + ide/qtcreator ide/sublimetext ide/vim ide/visualstudio diff --git a/docs/ide/qtcreator.rst b/docs/ide/qtcreator.rst new file mode 100644 index 00000000..19705b5a --- /dev/null +++ b/docs/ide/qtcreator.rst @@ -0,0 +1,113 @@ +.. _ide_qtcreator: + +Qt Creator +========== + +The `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 `_ +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 diff --git a/examples/ide/qtcreator/platformio.ini b/examples/ide/qtcreator/platformio.ini new file mode 100644 index 00000000..b79bfb2d --- /dev/null +++ b/examples/ide/qtcreator/platformio.ini @@ -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 \ No newline at end of file diff --git a/examples/ide/qtcreator/platformio.pro b/examples/ide/qtcreator/platformio.pro new file mode 100644 index 00000000..22188cd8 --- /dev/null +++ b/examples/ide/qtcreator/platformio.pro @@ -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 diff --git a/examples/ide/qtcreator/src/main.c b/examples/ide/qtcreator/src/main.c new file mode 100644 index 00000000..34714182 --- /dev/null +++ b/examples/ide/qtcreator/src/main.c @@ -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); +} +