adding i2c
dhcarstens
Posts: 11
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.
Comments
Let me draw this post to the attention of Matt.
- Ken Gracey
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.
Thanks!
Matt
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.
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.
Take it for a test drive, we'd love some feedback.