adding i2c

Is there any way to simply add an i2c interface to Blocklyprop? Other than writing a very long function from scratch. I'm using the Flip.


  • I'm sure there is. In fact, it might already be present through some of the high-level sensor interfaces we created for Parallax parts.

    Let me draw this post to the attention of Matt.

    - Ken Gracey
  • Hi!

    It's on the overall to-do list, along with SD card read/write/file blocks. I've made a couple small attempts at creating some, but I've gotten stuck. Do you have a specific sensor/ic in mind that you'd like to use it with? Have you done anything in C with it? I'm asking because sometimes we'd prefer to make blocks that are specific to a device/module, and if you have C code that works, it gives me a better idea of how to make the blocks generate the code needed to operate devices or modules.

  • JonnyMacJonnyMac Posts: 7,008
    edited 2017-11-21 - 18:07:52
    I hope you'll make the pin assignments for SD card flexible -- I'd like to be able to use my own designs and not locked to the pins used by the PAB.

    I think you could start with five fundamental blocks for I2C (would fit under protocols)
    -- Initialize I2C SCL [ v] SDA [ v]
    -- I2C Start
    -- I2C Stop
    -- I2C Write Byte [ ]
    -- I2C Read Byte [ ] Ack

    The initialize block could default to pins 28 an 29, but should allow the user to configure. The write block would be for byte values. The read block needs an option for Ack/Nak bit.
  • Thanks for all replies. I'm kind of a strange user. I've done several projects with C on various microprocessors since I retired in 2000. But every time I start something new I have to re-remember how to use C. I heard about Bloklyprop on Nuts and Volts and thought it would be a good way to learn about the propeller but also a quick way to put together tight code. So I bought the FLIP and am playing around with it.

    Currently, I want to apply it to controllers for model railroads (another hobby of mine) which could use numerous I2C modules. I'm used to working with microprosessor systems with large libraries of code and am surprised at the lack of such libraries on BP.

    I've looked at the I2C protocol and I think it's something that I could put together with BP, but it would be difficult to implement.

    However, I do understand who is your audience and the fact that you want to concentrate on Parallax sensors and parts.
  • Hi! It's currently in under COMMUNICATE > PROTOCOLS
    Take it for a test drive, we'd love some feedback.
  • Nicely done, Matt!
  • Great work, Matt!
Sign In or Register to comment.