Programming languages are actually commands "easily" understandable by humans and which once recorded are interpreted or compiled (I will explain the differences later) by a program which takes care of translating the lines of code into language binary.
Bonjour in binary language
In the first case, we need a python interpreter and an IDE (Integrated Development Environment).
So I recommend PyCharm open license (free ~_^)
I recommend, once you have downloaded the two programs to start by installing Python (32 or 64 bits depending on your operating system) and then installing« Pycharm ».
When the installation is complete, open Pycharm, then started a new project « file » > « New project »
Once the project creation window is open, you have to start by linking the python interpreter to Pycharm.
To find the interpreter made « windows + R ». next step %APPDATA% to get here.
Return to the Appdata folder, then « local » > « programs » and for finish « python » and find the interpreter.
Copy the interpreter adress then return to Pycharm selected « Existing interpreter » then paste the address of python and « Create ».
Here is our project created with success! to start the code, create a new file in python.
« file » > « new… » > « python file »
For start this tutorial, make:
Then click on the small green arrow at the top right.
Hello World is displayed in this window, good this is your first code !
Python is very easy to use. With this programming language , it is possible to do basic operations. (open your python interpreter with a Windows search)
For example simple calculations.
5623145 * 5115454)
the booleans (who returns «True» or «False» according to the result)
5 > 1
5 < 1
Now let's tackle the variables . These are extremely useful. They allow us to store values in a box (the cat = value, the box = variable).
Values can be strings of characters, numbers, and even operations ! But be careful to declare the "nature" of the variable . For example, for an integer, we will declare (int), for a decimal number (float) and for a character string (str).
Next, a variable cannot contain spaces. (an "underscore" _ can obviously be used as a space) Let's start by writing a variable "test" to which we will assign the sequence of characters " Steel Technics " in this way
test = ("Steel Technics")
Then « print » to display our variable.
test = ("Steel Technics")
Let's run our code with the green arrow to see that our code returns the value registered in the variable «test».
Our code returns to us:
In this second and last part, we will create a small program in python, thanks to it,
we will be able to carry out simple calculations in order to adjust our welding machine in process 111.
With python, we are going to create a control capable of directing us to the post amperage according to the coated electrode that we will choose for our weld.
The basic operation is: 50 x (thickness of the electrode - 1) = theoretical amperage for our weld.
So, to begin with, let's declare a variable this way.
electrode = int(input(« enter the thickness of your electrode.»))
Here, "int" means that we designate a whole number and the input command allows us to enter a value in our variable.
If you weld with a 2.5 mm electrode for example, it will suffice to replace "int" by "float".
Next, let's store the calculation in a “result” variable like this.
result = 50* int(electrode – 1)
Then let appear our result with:
So first of all, our program asks us for an electrode thickness, I give it 2 mm. The latter performs the calculation and returns me a result:
Here is a short program in python, next update I will explain how to refine this program with the conditions .