Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

feather m4 express i2c as digital out
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

feather m4 express i2c as digital out

by jwillner1958 on Mon Apr 13, 2020 9:52 am

Hello together,

I would like to use the i2c-interface as a digital out.
Is that possible?
Isn't working for me yet...

led1 = digitalio.DigitalInOut(board.D22)
led2 = digitalio.DigitalInOut(board.D22)
led1.direction = digitalio.Direction.OUTPUT
led2.direction = digitalio.Direction.OUTPUT


br

jwillner1958
 
Posts: 3
Joined: Thu Jan 04, 2018 3:17 pm

Re: feather m4 express i2c as digital out

by jerryn on Mon Apr 13, 2020 10:02 am

there is no board.D22 defined for the feather M4 express (you are using it for both leds ?? )

have you tried
Code: Select all | TOGGLE FULL SIZE
led1 = digitalio.DigitalInOut(board.SDA)
led2 = digitalio.DigitalInOut(board.SCL)
led1.direction = digitalio.Direction.OUTPUT
led2.direction = digitalio.Direction.OUTPUT


edited to add -- Just tested on a feather m4 express and it works for me.

jerryn
 
Posts: 1251
Joined: Sat Sep 14, 2013 9:05 am

Re: feather m4 express i2c as digital out

by jwillner1958 on Mon Apr 13, 2020 2:32 pm

thank you very much, that solved the problem.
I am a newby, was searching for the info, where this things are defined. but was not successful.
can you give me a hint, where to study this...
br Joachim

jwillner1958
 
Posts: 3
Joined: Thu Jan 04, 2018 3:17 pm

Re: feather m4 express i2c as digital out

by jerryn on Mon Apr 13, 2020 4:20 pm

It can be confusing - I assume that the references to #21 and #22 in the Guide "pinouts" section are for Arduino.
For CircuitPython, every board has a "pins.c" file that defines the pin mapping.
for the Feather M4 Express it is here https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/boards/feather_m4_express/pins.c#L37


I hope that helps. You can also ask questions like this in the #help-with-circuitpython channel on the discord server at https://adafru.it/discord

jerryn
 
Posts: 1251
Joined: Sat Sep 14, 2013 9:05 am

Please be positive and constructive with your questions and comments.