![]() ![]() I'll continue researching the issue here in the forum archive, but nothing I've tried so far seems to work. ![]() But I am really scratching my head as to why this isn't working, as the sample code seems pretty straightforward.Īnyway, I would be very appreciative of any additional information anyone could pass along. One thing I just realized that I did not do yet, is to measure the voltage from both the 3V3 and 5V headers, and I'll do that tomorrow. Ĭan anyone offer any tips as to what might be going on with this device? I don't believe that the Due is faulty-it seems to have normal function when powered both from the programming port and 7.5VDC in the barrel jack. Note that I have only tried pins 20/21 though, and not the SDA1/SCL1 pins ("Wire1"). I've also even tried to set up GND and VCC from pins A2 and A3, as is done in that code. Of note is that I've tried this several ways-I've wired the sensor directly from both 3V3 and (when that didn't work) 5V from the Due's headers, and of course GND from the Due header as well. ![]() The address is optional for master devices. The syntax for this is Wire.begin (address). After including the library, the next thing to do is to join the device on the I2C bus. In the sketch above, we do that with include .So is there some special voodoo magic required to use I2C on the Due? I wouldn't have thought so in reading those two threads, but the fact remains that I can't get anything at all from the device using that sample code in the Due.however it works great with the Uno. To use the functions in the Wire library, we first need to add it to our sketch. However there is no mention of either method in the current Wire library documentation-nor does my IDE seem to recognize either method. The things I find curious are the mention of the nd() and tup() methods in that second link, (presumably) in reference to setting up the Due for I2C. ![]() I understand that there are two sets of I2C ports on the Due, and I am using SDA(20) and SCL(21), presumably with the pull-up resistors enabled by default? A couple of the threads I've found here on the subject seem to indicate that they are enable by default anyway. In researching the issue on the main Arduino site, I of course reviewed the documentation for the Wire library. So I believe that the Due is working correctly. I've loaded the executable code from a few different example sketches into the Due, and it seems to work exactly as expected-including the on-board LED and the serial port. Essentially, nothing happens when I load the code-the normal pin 13 LED stays on, and there is no output from the serial port. However when I try the same code in the Due using the 1.5.2 Beta IDE, I do not get expected behavior at all. You should then see "hello world" messages sent through serial on both of your Arduino masters.I can get the code to work perfectly fine with the Uno, and I am positive that the thermometer is working. That's all, now connect Arduino Uno's I2C pins ( A4 and A5 ) between each board, not forgetting the pull-up (1.2kΩ is fine) resistors for both SDA & SCL. Wire.write("hello world from 0x2 to 0x1") Wire.write("hello world from 0x1 to 0x2") After lots of googling, I finally got an answer thanks to the official Arduino Forum : I should use multi-master I2C to allow all my Arduino's to talk to each other (and that doing, interrupting receivers as it would be the case with slaves).Äoing this is in fact pretty simple : you only to use the Arduino's official Wire (I2C) library as following. I've been working since many weeks (months) on designing a home automation "box" project, and could hardly find a way to get my Arduinos (actually bare ATMega328 + Arduino's Optiboot bootloader) communicating together without having the (physical) master poll all the other âs continuously. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |