What is Python?
The #1 Programming language*
- Python: 14.2%
- Matlab: 0.8%
- Labview: 0.14%
* as of March 2022, tiobe.com
What is Python, really?
A really easy to learn programming language
What else is Python?
An extensible system of software “packages”
- use pip/pypi to install
- install straight from github!
But what makes it unique?
An “interpreted” language
- In its simplest form, the Python interpreter simply runs human-readable scripts*.
- Can load and run code compiled in C, C++ FORTRAN, etc.
* there are many exceptions
Is there anything else?
- “Dynamically Typed”
- Variables don’t need to be declared as one type or another. You simply set them equal to something and they become that data type.
- Object-oriented
- concept of classes and inheritance
- “Public” by definition
- data is not easily hidden.
- data is accessible by anything
So then, why C?
- Lower level language that is easier to map to hardware-specific registers and functionality
- Compilation makes running code faster and more memory efficient
Python Interpreter
- Simple program that runs scripts or typed commands.
- A lot like
bash
, powershell
, or cmd
, only cross-platform and independent of the operating system.
What is MicroPython?
- A slimmed down, limited version of Python that fits within the program space of a little microcontroller
- The system of software packages written for it
- The same idea of an interpreter… you just access it over UART/USB.
What is Thonny?
- a Graphical User Interface (GUI) written in Python
- A text editor
- The interface to your device and its interpreter
- A nice way to re-flash your device
What is Anaconda/Miniconda?
- A way to manage all the “packages” you can install on your PC
- A solution for dealing with conflicting installation requirements.
- A way to share packages that contained OS-specific, compiled libraries.
Why do I need to use Anaconda?
Many packages include libraries that are compiled specific to one operating system
this requires a compiler, and understanding the compilation process in case it doesn’t work
or, requires access to compiled packages
* https://www.lfd.uci.edu/~gohlke/pythonlibs/
Ok, so how do I get started?
- Install anaconda/miniconda
- Install Thonny and some other packages
- Open Thonny
- Flash the ESP32 with MicroPython over USB
- Load some micropython libraries
- Start writing code.