Skip to main content

Posts

Showing posts from October, 2019
Micropython - v1.11-498 introduced a few changes in the source-code directory structure. Changes to specific files, as previously described in esp32-cam , will no longer work. A simple working summary on how to build esp32-cam firmware is described below: Make a recursive copy of ports/esp32 to ports/esp32-cam, and you will need to modify the following files: 1) ports/esp32-cam/main.c 2) ports/esp32-cam/Makefile 3) ports/esp32-cam/modcamera.c 4) ports/esp32-cam/mpconfigport.h 5) ports/esp32-cam/boards/manifest.py 6) ports/esp32-cam/boards/sdkconfig.base Or, you can just download a precompiled Micropython v1.11-498 from firmware.bin at GitHub if you want to save some work. However, I encourage you to compile the firmware yourself. You will learn a lot and you can choose to modify anything to your liking. The modcamera.c includes something new. The still photo was taken using these settings; pix =8, con =2, qua =10, and spe =2. You will understand those parameters, later...
Namespaces - Names are labels for identification. We use a name to refer to a thing. Several objects can have the same name, and this can create problems, calling out 'Robert' in a crowd, for instance. A thing can have many names, and this is ok, you call your friend Robert, Bob. MicroPython has two groups of names:  implicit  explicit We also have symbols +, *, - and alike. Implicit names are keywords and builtins. Keywords defined the language and can not be reuse. Statement in = 23 will give you SyntaxError, while id = 23 is ok. The difference is that the word in is a keyword and id is a builtin. Names created in our codes, functions, class, variables, are examples of explicit names. You can delete an explicit name using del . You will get NameError if you try to delete an implicit name. There are two types of object:  basic  composite Basic objects are single value objects like integer, character, float, character, and boolean. Composite...
Unix - I compiled the Unix port of MicroPython. It is useful for writing a program prototype before using it in a microcontroller. Sure, micropython on Linux does not have modules like those included for esp32 or esp8266. As I have mentioned earlier, MicroPython firmware for microcontrollers compiled by me does not include webrepl and upip modules. Here where micropython for Linux can be useful. Follow the following transcript to install any modules: $ micropython -m upip install micropython-upip Installing to: /home/sharil/.micropython/lib/ Warning: micropython.org SSL certificate is not validated Installing micropython-upip 1.2.4 from https://micropython.org/pi/upip/upip-1.2.4.tar.gz I got two new files under the installing directory namely; upip.py and upip_utarfile.py You can then copy these files to /pyboard in your rshell session. I assumed the modules are already nearly bug-free. I usually copy a mpy file to my microcontrollers. Use mpy-cross to compile any py fi...