Micropython M5Stamp Stamp I/O Help please?



  • And another Micropython I2C help request.
    Is anyone using the Stamp IO expansion stamp?
    I'm having problems understanding how to control it and its not in UIFlow yet!



  • Hello @ajb2k3

    on the document page the Stamp I/O Arduino examples point to the ExtIO2 unit examples.

    So, I'd try the UIFlow blocks for the ExtIO2 unit.

    Thanks
    Felix



  • @ajb2k3 0_1676521840017_E2409982-3342-41EE-952A-A694B8453C98_1_105_c.jpeg
    Adam, I nearly went mad getting this to work! Part of the problem was wrapping my brain around how it worked. It is a silly invention of little use, I say!
    I found a weakness in the library that prevented individual pin functions, like pin 1 input, pin 2 RGB, pin 3 output.
    Our friend felix edited the library header and did a pull request and now they are all individually selectable. This image is actually a short video, but I don't think I can upload it here. Imagine if you will, the LED blink-ing...
    However the examples were NOT updated and they still say "AllPinMode", so this is confusing.
    I realize this is C, but it might be illustrative for translation to UIflow?
    Terry



  • @teastain @felmue I've read, reread and experimented in micropython and still get a problem trying to control it.
    Mind you I have a cold so my brain isn't at its best but every time I trying to i2c.write() it causes a Error19: ENOMEM meaning I'm doing something wrong.

    Something about access the registers is not working for me.



  • I think I may have broke it!0_1676567548176_Screenshot 2023-02-16 at 17.11.34.png



  • I found a clue to programming it. It is the EXTI/O2 Unit in a miniaturised form. Same hardware, firmware and address.



  • Way hay I got it.
    in micropython you use

    i2c.writeto_mem(0x45, 0x00, b'\x01')
    

    to set the mode and then

    i2c.writeto_mem(0x45, 0x10, b'\x01')
    i2c.writeto_mem(0x45, 0x10, b'\x00')
    

    to turn each pin off and on it digital mode.

    And I can conform that the EXT I/O 2 and the ExtI/O stamp are the same units!