Hi,
While trying to understand a program that uses 'I2C' I discovered that there are two I2C functions available: One to import from "machine", the other from "pyb".
One is related to the HARDWARE and the other to the BOARD which seems to me the same thing.
So my question is: What is the difference between FROM MACHINE and FROM PYB, or what is the difference between HARDWARE RELATED and BOARD RELATED?
Regards,
Gilbert
What is the difference between: From machine and From pyb
-
- Posts: 363
- Joined: Sun Apr 17, 2016 1:55 pm
Re: What is the difference between: From machine and From pyb
pyb is for pyboard (STM32) only, and machine is common hardware library, it fits most of the hardware.
Re: What is the difference between: From machine and From pyb
OK thanks,
but why maintaining two I2C libraries, and which one is the best?
And it would have been very helpful if the Quick reference guide would have pointed that out. (it took me quite some time to find out there was another I2C library with different commands/methods.)
Regards
but why maintaining two I2C libraries, and which one is the best?
And it would have been very helpful if the Quick reference guide would have pointed that out. (it took me quite some time to find out there was another I2C library with different commands/methods.)
Regards
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: What is the difference between: From machine and From pyb
There isn't a "best" one: both have an intended application. If you want to write portable code, use machine. You may find that machine meets all your needs. It represents a basic hardware abstraction which can be expected to be found on all bare metal MicroPython targets.
If you want to access the extensive hardware features which are available on STM chips, use pyb. The latter opens up a whole world of possibilities and is well worth learning if you have a Pyboard. My personal view is that if you're only ever going to program Pyboards, use pyb. It is much more capable.
If you want to access the extensive hardware features which are available on STM chips, use pyb. The latter opens up a whole world of possibilities and is well worth learning if you have a Pyboard. My personal view is that if you're only ever going to program Pyboards, use pyb. It is much more capable.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: What is the difference between: From machine and From pyb
Thanks pythoncoder,
It is very clear to me now.
Thanks,
Gilbert
It is very clear to me now.
Thanks,
Gilbert