All information about this tutorial is available on a TWiki server.
TWiki uses the same documentation format as Wikipedia.
This makes it very simple for the lecturer to provide on-line documentation,
which can be extended by students.
This is our Twiki server:
https://afnog.iotworkshop.africa/do/view
Other pages for class resources
Micropython Demos:
https://github.com/uraich/MicroPython_IoTDemos and
https://github.com/uraich/MicropythonCayenneMQTTClient
C++ version:
https://github.com/uraich/C-IoTDemos
When the Internet was invented it was used for communications between humans
Typical applications where:
Remote login
File transfers
or with centralized servers over the network and they can observe their environment
with dedicated sensors.
This is what we call the Internet of Things (IoT)
The python programming language is a high level programming language that is very interactive and object oriented.
Python is an interpreted language which means that the statements which make up the python program is processed at run-time but not compiled first.
Python also supports object oriented programming style which employs the use of encapsulating codes within objects.
What can python be used for?
Used to create web applications.
Used to connect to database systems.
It can be used to perform complex mathematics
It can be used in data analysis.
For Python beginners: https://docs.python.org/3/tutorial/index.html
and for everybody the Python docs: https://docs.python.org/3/index.html
Python is a programming language that lets you work more quickly and integrate your systems more effectively.
Python is powerful... and fast;
plays well with others;
runs everywhere;
is friendly & easy to learn;
is Open.
Simply type python in your terminal and press the enter key to start the interactive python mode.
Type print(“Hello world”). Hit enter and it prints Hello world on the screen.
To exit from the interactive mode, type quit().
Using the interactive mode doesn’t keep the statements of code we wrote permanently .
But in an ideal situation we might want to keep the codes for future reference.
Hence we make use of an editor like the nano, emacs, etc.
Instead of running a standard editor like nano or emacs you may want to run
an Integrated Development Environment (IDE) created specifically for Python instead.
Thonny is Easy to get started. Thonny comes with Python 3.7 built in,
so just one simple installer is needed and you're ready to learn programming.
It is very suitable for beginners and programming micro-controllers
For basic description of Thonny check https://thonny.org/ and https://realpython.com/python-thonny/
Here you see the 2 idle windows.
The top one contains the editor, the second the Python shell
Script in python can be run from the Linux command shell with:
python3 scriptName
or we can make it executable and run it like we would run
any compiled C program or any bash script:
Programs can be called with arguments.
Python has a module that helps users parse command-line options and arguments.
Many programs can be run to provide basic information about how they
should be run and it employs the use of command line arguments.
The Python sys module provides access to any command-line arguments via the sys.argv .
Variables are just memory allocations for storing values.
Every variable created has a space in memory allocated for it.
Based on the data type of a variable, the interpreter allocates memory and
decides what can be stored in the reserved memory.
Python variables do not need explicit declaration to reserve memory space.
The declaration happens automatically when you assign a value to a variable.
The equal sign (=) is used to assign values to variables.
The operand to the left of the = operator is the name of the variable and
the operand to the right of the = operator is the value stored in the variable.
-- Isaac Armah-Mensah - 2019-05-30