I am trying to build a custom GUI of my own using Qt designer and PyQt5 script. I have properly placed and coded all the buttons and text edits in my GUI. I want to compile and upload arduino sketch from my GUI using the platformIO CLI or the platformIO IDE integration. As of now I have no clue how to achieve it. Can anyone help me with it.
This is a picture of my GUI
How will I run the Widget file which is given in the example on windows?
Widget
file is just the example how to use QProcess
to communicate between applications, everything else you should write by yourself.
Any idea how to install platformIO for python 3.4?
PlatformIO supports only Python 2.7. In theory, it could be run with any Python versions but it depends on SCons tool which supports only Python 2.7.
The workflow from the PlatformIO side should be next:
- Each PlatformIO command should be run with the next required options:
platformio -f -c myqtapp
, where-f
tells PlatformIO to force any prompts and avoid blocking operation;-c myqtapp
is unique identifier of your application (you can choose any other ID). - When user presses “Compile/Upload” button you need to initialize PlatformIO project. See platformio init command docs. For example,
platformio -f -c myqtapp init -d /path/to/tmp/dir --board uno
. This command initializes new PlatformIO project for Arduino Uno board in/path/to/tmp/dir
directory. - Place source code(maybe from your GUI code editor) to
/path/to/tmp/dir/src
direcotry assketch.ino
. - Build project via
platformio -f -c myqtapp run -d /path/to/tmp/dir
- Upload firmware via
platformio -f -c myqtapp run -d /path/to/tmp/dir -t upload
.
P.S: You can omit -d /path/to/tmp/dir
with running this command from CWD where is project located.
Can you elaborate on how to ID the “myqtapp” so that it refers to my GUI. And all those commands that you have suggested are to be executed in CMD and the output to be shown in my GUI, right?
This ID is used inside PlatformIO CLI for better handling of own subprocess. I propose you to set it to the name of your application. For example, for IDEs it equal as -c eclipse
for Eclipse IDE, -c vim
for VIM text editor and etc. The one rule here is [a-z-0-9]
chars.
Right. Take a look on Sublime Text Project Template for PlatformIO.