Ante todo soy novato en esto, estudie electronica hace lo menos 15 años pero estoy algo pez ya..... y necesito ayuda.
Estoy intentando montar dos dispositivos por I2C (un lcd y un modulo reloj (ds1307))) en un arduino mega 2580, pero solo logro hacer funcionar la pantalla, el timer no funciona. Conecto ambas patillas SCA y SCL a las correspondientes de Arduino con una resistencia de pull-up a 5Vcc, la masa GND a la correspondiente y la vcc igual pero nada.
Ademas de indicarme si estoy conectando algo mal he pensado en comprar otro modulo timer por si el que me mandaron no va, alguien me podria recomendar uno en un sitio en concreto de firar???.
Gracias por tu interes, hace tiempo que lo intente y ahora lo quiero retomar....
Este es mi hardware:
ARDUINO...
TIMER...
PANTALLA...
Este es mas o menos el esquema:
En cuanto al código use muchas variantes pero ni con el que venia de ejemplo pero la hora nada 00:00:00 buscare el código pero probe con muchas variantes y nada.
// The following lines can be commented out to use the values already stored in the DS1307
rtc.setDOW(SUNDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(3, 10, 2010); // Set the date to October 3th, 2010
// Set SQW/Out rate to 1Hz, and enable SQW
rtc.setSQWRate(SQW_RATE_1);
rtc.enableSQW(true);
has probado con el rtc por separado? con el codigo que viene arduino? bueno no se si viene con arduino, te adjunto la libreria.
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Serial.begin(57600);
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}
}
void loop () {
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();
Serial.print(" since midnight 1/1/1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now.unixtime() + 7 * 86400L + 30);
Serial.print(" now + 7d + 30s: ");
Serial.print(future.year(), DEC);
Serial.print('/');
Serial.print(future.month(), DEC);
Serial.print('/');
Serial.print(future.day(), DEC);
Serial.print(' ');
Serial.print(future.hour(), DEC);
Serial.print(':');
Serial.print(future.minute(), DEC);
Serial.print(':');
Serial.print(future.second(), DEC);
Serial.println();
Serial.println();
delay(3000);
}
comprueba la velocidad del puerto de serie en tu sketch, creo que por defecto viene con 57600 y comprueba cuanto tienes seleccionado en la pantalla del serial monitor