The world is so big, so many languages, why choose Micropython, its advantages?

Source: Internet
Author: User

Recent domestic Micropython swept the procedural circle, what causes it to be so hot? Is it because he is powerful and open source according to the MIT protocol?

Wrong! Because the use of it is really too comfortable!!!

Micropython's origins, thanks to Damien George, a great computer engineer, Damien George uses Python every day, and one day he comes up with a bold idea: can you use Python to control your microcontroller, To achieve the operation of the robot?

The Python language itself is a simple scripting language, and some non-computer professionals choose the Python language as the starting language, but in the ointment (why China and the United States do not participate in the World Cup), it can not achieve some of the bottom of the operation, in the hardware field is insignificant. So, Damien George used 6 months to build the Micropython, this is the origin of Micropyhton.

Micropython It is based on Ansic, and the syntax is basically consistent with Python3, with independent parsers, compilers, virtual machines, and class libraries. He currently supports 32-bit-based ARM processors, such as stm32f401, stm32f405, and stm32f407.

Below tell everyone I use assembly, C, Micropython these 3 languages do the following several comparison, why say Micropython use so comfortable?

1. Compiling the Environment
C language, assembly language before writing a program, you need to download the compilation environment, however, Micropython does not need any compilation environment, just plug the Development Board U port into the computer, you can appear on the computer a drive letter, and insert a USB stick like, and then open the USB flash drive, Direct Notepad edit main.py on the line, it is comfortable in Micropython do not need any tools and environment, any text Tool + 1 Development Board can be developed and compiled, you may give it a nickname-pocket programming Computer ... Domestic do better is Tpyboard v102 Development Board, interested can go to learn about it, it is complete, there is video learning materials, or good, I was so into the pit of OH.


2. Difficulty in operation
Assembly language Basic operation is simple, but to achieve complex project objectives is relatively difficult, the code is lengthy, debugging troubleshooting difficulties; C has a statement and a lot of library functions, relatively simple relative to the assembly; Micropython has more library functions than C, and the code format is not only concise, In the library support many functions and methods do not have to write their own, directly import XX can, the class library import on OK. Once a lamp requires five or six lines of code, now only 1 lines of code to light Led,so easy.


3. Program Structure
assembly language in general use jump structure, whether it is a subroutine call or loop or scattered in theory are used to jump, interrupt operation or force out the operation of the program section need to have accurate control of the stack, the requirements are very strict; C language generally uses circular structure or sequential structure, no longer need to jump around to execute the program, The interrupt operation automatically pushes the stack without human intervention, which can be embedded in the assembly to improve efficiency when timing requirements are high; Mciropython can use C's program structure or use the thread structure, the thread structure requires strict and reasonable allocation of good thread work time can not conflict, the resources have a good control, Can not be empty hanging thread waste resources, in theory, multithreading can be more efficient operation, although the single core can only be run single-threaded but from a macro point of view is synchronous, in the case of less stringent time requirements can effectively reduce the programming difficulty.

4. How to Write
Assembly without the use of macros, usually is the direct operation of the command unit, the need to remember a large number of data unit use, and because of the number of program lines (possibly to one thousand or two thousand rows) need to go back and forth to look at the program code, the whole writing process is cumbersome. And because all the 8-bit complex data operations need to be nested in the C language to complete, C language use any variable needs to be defined first, compared to not deliberately to remember the variable name, the overall structure is clear most programming software has the function of jumping rotor program, find the program block is very convenient. There are a large number of finished product header files contain a variety of commonly used functions, relatively less complex program code writing; Micropython inherits the writing advantages of C, does not need to be predefined, does not need any end symbol, only need to break the line to continue to write, but pay attention to some special Cases tab key use.

5. Ease of Reading
The assembly itself is difficult to read because the tag is small and the direct Operation unit, the visual structure of not only two columns of code and need to constantly jump so it is difficult to read it, C language simple operation code is clear, but the complex will find methods in the method, a lot of complex code is not I go to find, let people feel very headache , Micropython compared to C has a better legibility, and because of the cancellation of a lot of special symbols of the overall feeling is also relatively clear, many methods are written separately as a separate library, direct call can, each function has a separate class library, looks extremely convenient, at a glance.

By comparing these dimensions, you should easily know why I say Micropython is comfortable to use. AI is currently the mainstream of social development, the emergence of Micropython is a time, so many beginners like me, can also do their own smart car, learning hardware, it is more simple than C language learning, more suitable for joining education, everyone can learn programming, write programs, From this we can see that micropython future market prospects are very large, is more powerful than Arduino, more easy to program the Development Board.

The world is so big, so many languages, why choose Micropython, its advantages?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.