Help with I2C Real time clock on other analog pins.

Hi everyone,

I have the sparkfun real time clock module, since its a i2c module I connect SDA to analog pin 4 and SCL to analog pin 5 then with certain code everything works well, but currently I connect it using jumper wires, but if there is a way I could swap analog pin 4 and analog pin5 I could put 5volt on the other analog pin so I could plug the rtc module in directly, so I think I found the solution but my knowledge is getting me, SoftI2CMaster.

So I downloaded a version here: http://www.findthatzip.com/search-27026380-hZIP/winrar-winzip-download-softi2cmaster-zip.htm, since there is a ds1307 example where analog pin is on digital pin 2 and 3, but I could not get the code verified without error as is !?!? :0

Here is the supporting article for that examples in the download: http://livebox-hah.googlecode.com/svn-history/r244/trunk/userapps/arduino/libraries/SoftI2cMaster/Example/readme.txt

One of the main errors is 'error: 'uint8_t' does not name a type'

Or if anyone is a expert with SoftI2CMaster, all I want to do is swap the analog pin 4 and 5 so that sda is scl and scl is sda, and then read the date time as I would normaly do as follow:

DateTime now = RTC.now(); Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); if (now.second() == 0) { digitalWrite(2, HIGH); delay(3000); } else { digitalWrite(2, LOW); } Please any help would be appreciated since we all love our Arduino's in the arduino family.

You could use a protoshield to mount RTC on board

Using this library GitHub - adafruit/RTClib: A fork of Jeelab's fantastic RTC library , reading time is pretty easy,

#include <Wire.h>
#include "RTClib.h"
char date_time[30];
RTC_DS1307 RTC;
 
void setup () {
    Serial.begin(9600);
    Wire.begin();
    RTC.begin();
}
 
void loop () {
    DateTime now = RTC.now();
  //  Serial.print(RTC.now());
  sprintf(date_time,"%d/%d/%d %d:%d:%d",now.day(),now.month(),now.year(),now.hour(),now.minute(),now.second());
  Serial.print(date_time);
  Serial.println();
  delay(1000);
}