Hi all
I have read a number of posts on I2C but did not see a specific look at " int Wire.write(uint8_t)" a method accessed by the intel Wire.h header . This method does not seem to be working as required.
I decided to use a Real Time Clock as my test device since they are pretty standard.
Using the Arduino / Edison I can read the DS3231 rtc, but not write to it whilst using the Sketch below.
The same Sketch works "perfectly" on a MEGA 2560.
The Arduino IDE file is attached below .
Excerpt from attached Sketch
void set3231Year()
{
// Use Yxx where xx is a 2 digit year
year = (uint8_t) ((Serial.read() - 48) *10 + (Serial.read() - 48)); //
Serial.print("The new year will be : "); Serial.println(year);
Wire.beginTransmission(DS3231_I2C_ADDRESS); // Open the RTC
Serial.print(Wire.write(DS3231_year)); // write the address pointer to the device in this case 0x06 = DS3231_year reports 1 byte written
Serial.println(" addresss uint8_ts were written.");
Serial.println( Wire.write(decToBcd(year))); // Write the byte of data to the register at 0x06
Wire.endTransmission();
}
after execution of this method, the RTC remains unchanged