Things to do :
- Write an application that interfaces with an input and/or output device that you made
- Include original code
PythonFor this weekly assignment I started whit Python.I already installed Python3 in Input device week,in order to check the python version I wrote the command in the terminal : python3 -V and I veryfied that the version installed was the 3.5.2.
My goal for this week was to create a simple interface ( like a button ) that could turn on the led I provided in my Hello Board.
To do that I needed something to manage the serial comunication and a library for the GUI.
Knowing nothing about python I read this tutorial thanks to the wise advice of Dario
Now I had to install those library I needed .
First of all I had to install Pip3.As it said in the link pip is a package management system used to install and manage software packages written in Python.
To do this step I used the command
sudo aptitude install python3-pip
Next I updated pip and installed the libraries I needed:
Whit python correctly installed I wrote a simple Arduino's code to manage the led behaviour when the board receive something from the serial port. In particular if it receive '1' turn on the LED and if it receive '0' turn off the LED.
Then I flashed it into my Hello board and I moved on coding in python.To create my interface in PyQt5 I followed the tutorial I linked above in particular for manage Buttons,Labels and Geometry.
The code isn't hard to understand and it has some comments to explain what every parts do.
I saved it as interface.py in a desktop's folder called interface.Opened the terminal inside this folder and typed
and this is the final result :