simple method to identify which expansion board is being used?
philwilkinson last edited by philwilkinson
is there a simple micropython method I can call to determine the expansion board/pyscan/pysense/pytrack my pycom devboard is connected to?
The only option I can think of is to use exception handling. e.g. try py = Pysense():
Here's a method to create a generic exp. board object:
from pycoproc import Pycoproc from pysense import Pysense from pytrack import Pytrack # create exp board object using unknown board type pyexp = Pycoproc(1) if pyexp.read_product_id() == 61458: print("Using Pysense") pyexp = Pysense() if pyexp.read_product_id() == 61459: print("Using Pytrack") pyexp = Pytrack()
Later on use eg:
if pyexp.board_type == pyexp.PYSENSE: si7006 = SI7006A20()
Perhaps someone can tell us the id for the Pyscan board.
read_hw_versionis what you need.
Note that this won’t work for the first versions of the expansion board which didn’t have a PIC.