modul ds1307

ferey
mar, 04/26/2016 - 22:56
bonjour
j ai un problème avec mon module ds1307
j ai teste avec plusieurs librerie ,plusieurs carte (mega 2560 ,nano et duemilanove )
après televerser
code
#include <Wire.h>
#include "RTClib.h"
#include "TM1637.h"
#define ON 1
#define OFF 0
int8_t TimeDisp[] = {0x00,0x00,0x00,0x00};
unsigned char ClockPoint = 1;
#define CLK 2//pins definitions for TM1637
#define DIO 3
TM1637 tm1637(CLK,DIO);
#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
#define Serial SerialUSB
#endif
RTC_DS1307 rtc;
//char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup () {
tm1637.set();
tm1637.init();
#ifndef ESP8266
while (!Serial); // for Leonardo/Micro/Zero
#endif
Serial.begin(9600);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
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(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
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(daysOfTheWeek[now.dayOfTheWeek()]);
//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");
// Serial.println();
// delay(5000);
tm1637.point(POINT_ON);
TimeDisp[0] = now.hour() / 10;
TimeDisp[1] = now.hour() % 10;
TimeDisp[2] = now.minute() / 10;
TimeDisp[3] = now.minute() % 10;
tm1637.display(TimeDisp);
delay(500);
tm1637.point(POINT_OFF);
tm1637.display(TimeDisp);
delay(500);
}
le moniteur serie me donne sa
RTC ne fonctionne pas !
165/165/2165 165:165:85
165/165/2165 165:165:85
165/165/2165 165:165:85
cablage sur les diferent carte ok
j ai rachete un module et meme probléme
si quelle qu un a une solution
merci
Cédric29
jeu, 04/28/2016 - 21:45
Salut.
Alim insuffisante? http://www.instructables.com/answers/Why-doesnt-DS1307-work-on-my-arduino/