First we need a Micropython interpreter!
You find the sources here:
https://github.com/micropython/micropython/
In the repository you find ports for the ESP8266 and the ESP32.
In order to compile the code you need the ESP-IDF and its cross compilers
The code compiles into a binary file (firmware-combined.bin) which contains a boot loader and the interpreter.
This binary must be uploaded and flashed.
For documentation of the ESP32port of Micropython look at
http://docs.micropython.org/en/latest/esp32/tutorial/intro.html
How to communicate with the Micropython interpreter?
We use a serial connection passing through the micro USB connection.
As soon as we connect the processor card to the PC we see the serial port to connect for communication
Compiling a new version of Micropython is substantially much easier with Thonny.
You still need to install esptool first. You just select your port and firmware then install.
A \x93Hello World\x94 program, just printing \x93Hello World\x94 on the screen
does not look very exciting.
However, this is generally used to verify that the infrastructure
Compiler, linker, downloader, flash program
are working correctly
In embedded systems printing can be quite complex
and a blinking LED is used instead.
The LED is connected to a digital line which can only be set to 0 or Vcc.
How can we change the light intensity and dim the LED?
The light intensity depends on the average current flowing through the LED.
The answer is PWM: pulse width modulation.