Page 1 of 1

Get Pins from SPI

Posted: Sat May 12, 2018 6:33 am
by mcauser
Is it possible to get a Pin object from an SPI object?

Code: Select all

>>> from machine import Pin, SPI
>>> spi = SPI(2)
>>> spi.init(baudrate=6000000, polarity=0, phase=0)
>>> print(spi)
SPI(2, baudrate=5250000, polarity=0, phase=0, bits=8)
I know the MISO pin on my board is B14. Instead of typing this...

Code: Select all

>>> miso = Pin('B14', Pin.IN)
>>> miso.value()
I'm hoping to get it from the SPI object. Something like this...

Code: Select all

>>> spi.miso.value()

Re: Get Pins from SPI

Posted: Mon May 14, 2018 6:12 am
by pythoncoder
That looks like it might make a worthwhile PR ;)