Announcement

Collapse
No announcement yet.

Problems with I2C Communication

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with I2C Communication

    Hello, I've been trying to get into I2C communication between my Diablo16 Display, and an Arduino Uno R3, but i don't seem to be able to make them talk to each other.

    The premise of my application is simple, i have 3 sliders to control 3 values determining the colour of an RGB LED Diode, and i wish to send these 3 values to the Arduino Slave, which is then to change the color of the Diode connected to it. I've also added a LED to the display in order to have a reference for what the LED connected to the arduino should look like.

    However i cannot seem to send the 3 values to the arduino, I'm unsure if im missing something essential in the I2C message, or how i've set it up.

    I added in a serial connection to the arduino in order to check how far it gets in the code, and it never begins recieving as far as i can see.
    I would have added some kind of progress indicating code to the display, but i'm not entirely sure how i'd go about that either.

    I've added a .zip file with my 4Dworkshop files and arduino program.

    Thank you in advance for any help.

    RGB I2C Test.zip

  • #2
    Quick update, i made an I2C Scanner application, and i think i've found the arduino address, however even if i include the address that the scanner gives me, nothing happens, the arduino still never gets a receiveEvent, and i am thus still stuck.

    Comment


    • #3
      Okay so i finally figured out my problem, it was the slave address all along, and i didn't realize my I2C scanner was reading out addresses in Numeric, and not Hexadecimal, i got the numeric address 18, but tried using that as hex (i.e 0x18) which of course was wrong.
      Having said that, is there an easy way to convert a numeric number to Hexadecimal? i would like to finish up my I2C scanner properly, so the addresses it lists are accurate, and don't need a second hand conversion. I've looked through the programmers reference but can't seem to find what im looking for.

      Comment


      • #4
        Hello,

        I am sorry if I got confused. Can you please explain again your problem and if possible, can you also attach your updated project so we can take a look.

        Best regards,
        Kevin

        Comment


        • #5
          The original Problem i had, was that i couldn't get my Diablo16 processor to talk with my Arduino Uno over I2C, however that ended up being a simple addressing mistake, I solved that by making an I2C address scanner, and using the addresses i got from it.

          Currently i would like to know if there is an easy way to convert a numeric value into a hexadecimal value.

          Comment


          • #6
            Hello,

            You can directly print the values on the display in hexadecimal format using this line of code:
            Code:
            print([HEX2]r);
            On Arduino side, you can use the function sprintf() to convert the decimal into hexadecimal format.
            Code:
              char hex[7] = {0};
              sprintf(hex,"%02X%02X%02X",R,G,B);
              Serial.println(hex); //Print the string.
            Best regards,
            Kevin

            Comment


            • #7
              That worked perfectly!
              Thank you very much for the help.

              Comment


              • John Kevin
                John Kevin commented
                Editing a comment
                No problem! I am glad it helped.
            Working...
            X