I have three arduino, one ethernet shield, SD Card and one router.
The arduino with ethernetshield is communicating the HTML File on SD Card with IP number. I wrote the code and it does not create a trouble. I connected the router with my phone and read html file from arduino and I sent checkbox information with ajax to arduino. There is no problem so far.
As second step,
I want to start I2C communication between arduinos(the arduino with ethernet shield will be master and the others arduino will be slave.) and master arduino will sent the information that received from HTML file.
I wrote necessary code for ı2c communication but it is not working. could you please help me about this issue.?
I want to start I2C communication between arduinos(the arduino with ethernet shield will be master and the others arduino will be slave.) and master arduino will sent the information that received from HTML file.
Why did you choose I2C? Do you know the limitations? Max. bus length is about 0.5m!
I wrote necessary code for ı2c communication but it is not working. could you please help me about this issue.?
No, because you failed to post the code that contains the error.
1. Check carefully and find that you are missing the following code in the setup() function of your master.lnk.ino program.
Wire.begin();
2. You have sent two different data bytes (x and y) from Master to Slave using I2C Bus. At the slave side, there is no mechanism to determine which one is x and which one is y. You need to use some kind of flag to accomplish it.
Please, implement the above two recommendations in your sketches; upload the sketches and report the result.
In addition to what GolamMostafa already told you:
in your slave sketch the x variable must be declared "volatile", otherwise the compile might optimize it away.
In your master sketch you don't terminate the string you got by HTTP with a null byte but use C string functions as strlen() on it. You clear the string after the first use and fill it completely with zeros, so it's only problematic in the first request.
You should read the complete request even if you throw the content away immediately.