pyb vs machine

OpenMV related project discussion.
OutoftheBOTS
Posts: 78
Joined: Tue May 29, 2018 4:15 am

pyb vs machine

Postby OutoftheBOTS » Thu Jun 07, 2018 7:10 pm

This is just some food for though about future direction.

pyb module in MicoPython has been replaced by the machine module. Only a few years ago there was only 1 board that ran Micro-Python and it was called the pyboard that ran on a STM32 chip. The pyb module was methods for controlling hardware on the pyboard.

Since then many new ports of Micro-python for a number of new chips: ESP8266, ESP32, SAMD(adafruit circuit-python)

One of the big ideas of MicroPython is to have code portable from 1 chip to the next i.e my micropython script will run on all ports of micropython on all chips without needing editing. For this reason pyb module was replaced by machine module to make it consistent across all platforms of micropython.

Both pyb and machine are included in official MicroPython port so that it is backward compatible but I do believe to is planned to phase out pyb. ESP8266, ESP32 and circuit-python ports have already removed the pyb module from their builds.

I would suggest all new code is written around machine module rather than pyb module
User avatar
kwagyeman
Posts: 1952
Joined: Sun May 24, 2015 2:10 pm

Re: pyb vs machine

Postby kwagyeman » Thu Jun 07, 2018 8:10 pm

We don't really write code for either but just provide both modules.
Nyamekye,
OutoftheBOTS
Posts: 78
Joined: Tue May 29, 2018 4:15 am

Re: pyb vs machine

Postby OutoftheBOTS » Thu Jun 07, 2018 9:46 pm

Ok I was juts following your examples and they all use the pyb module and I didn't realize that the machine module was available so I changed my ESP32 screen script to pyb but now I have just tried my original script with machine and it works fine. :)

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests