I'm trying to learn about the I2C protocol and for learning purposes wanted to write my own I2C implementation for the atmega micro-controller. Since it's hard to debug, I decided to write the 'draft' on raspberry and then re-write it for the micro-controller.

The problem I'm facing now is that I don't understand how can I simply write/read from the GPIO pin at the lowest level possible. Is there a 'basic' module, which will allow me to access GPIO pins directly (through some kind of system file)?

Basically I want to program Raspbery GPIO pins the same way I would program a micro-controller.

1 Answer 1


I'm not convinced that a Pi based implementation of I2C will be at all helpful towards an ATmega implementation.

Perhaps you'll let us know when you have done both.

The following link points to some of the many GPIO libraries available on the Pi. It also gives a sysfs method (accessing the GPIO via a filesystem).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.