Introduction: Debian Jessie I2C Communication With C# .Net Core

Picture of Debian Jessie I2C Communication With C# .Net Core


Recently i have to test a project out in the .Net Core Framework 2.0.
This framework, since the version 2.0.0. runs on Linux.
That´s the reason why i wanted to test out how the communicate on raspberry with an arduino over I2C works.

So i started "googling" with tutorials! I found many tutorials on Win10IOT but nothing with debian jessie.
But then i found this one...

Then I started to test out different things....

My work ends with this solution which i bring to you now!

Step 1: Coding Session

Picture of Coding Session

When you read the site, what i link to in the previous step, you will notice, that there is only described how to read from but not how to write to it!
Here is the solution i have created:

Code Questions:

  • What are the lines with "DLLImport" thing over the method ?
These are methods from another class and from another programming language we need that to communicate!
  • Why there are methods duplicated (like "Open,ReadFromDevice, WriteToDevice") ?

These are methods i have created to make the code, in my opinion, easier.

  • Why is the buffer length in the "ReadFromDevice" Method 1 ?

This is my testing scenario, if you want, you can add more !

  • What is the "I2C_SLAVE" variable and why specially 0x0703 ?

Well, i have no idea why it´s so, but in this situation this is the only way it works!
I think, i have also to study!
I look forward for your answer or opinion =)

Step 2: Picture of the Code!

Picture of Picture of the Code!

Step 3: Ending

Well my english isn´t the best (Austrian =) ) but
i hope, you understand the point and the meaning of this code and instructable!

I look forward to your comments !


Swansong (author)2017-08-16

Thanks for sharing :)