hi, i see you have got the ds1307 working, i am trying to do the same but no luck. can you give me a few examples of how to read the time from the chip? am pretty sure i have it wired up correctly. SCL to analgue 5 and SDA to analogue 4. do i need to do anything with SQW?
hi, I am trying to use an interrupt to call a function which uses the wire library, but it seems to crash at this point. Is it not possible? Eg i try this:
function i try to call:
void gettime() { // Below required to reset the register address to 0. Wire.beginTransmission(104); Wire.send(0x00); Wire.endTransmission();
Wire.requestFrom(104, 7); second = Wire.receive(); minute = Wire.receive(); hour = Wire.receive(); day_of_week=Wire.receive(); day = Wire.receive(); month = Wire.receive(); year = Wire.receive(); }
and where i attach interrupt:
attachInterrupt(0, gettime, CHANGE); //red wire
i can use interrupts for simple things like in the example, and my function gettime() works when not called from an interrupt. Is it because wire lib uses intterupts? any ideas would be welcome.
I think to use I2C you have to use the analogue pins 4 and 5. if you look at the pin descriptions http://www.arduino.cc/en/Hacking/Atmega168Hardware you can see SCL and SDA are there. Maybe i'm wrong though and it is possible to use the digital pins.