Probleme RTC PCF8523 et nano

bonjour,
je vous soumets mon probleme qui sera surement très simple à résoudre :
Je voudrais déclancher une action en fonction de l'heure
j'ai un nano et un rtc pcf8523
Lorsque le nano est branché en usb avec le monitor, tout marche nikel, lorsque je debranche l'usb, mon action ne se declenche plus !
comment faire fonctionner ce sketch en "autonome" sans etre avec le serial monitor ?
Merci à tous
Voici mon sketch :

#include "RTClib.h"

RTC_PCF8523 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {
 Serial.begin(57600);
 pinMode(13, OUTPUT);


  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    abort();
  }

  rtc.start();
}

void loop () {
    DateTime now = rtc.now();
int date_heure=now.hour();
int date_minute=now.minute();
    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(date_heure);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.println();
    if ((date_heure==0 and date_minute==0) or (date_heure==6 and date_minute==0) or (date_heure==8 and date_minute==47)  or (date_heure==8 and date_minute==50) or (date_heure==8 and date_minute==52) or (date_heure==18 and date_minute==0) or (date_heure==21 and date_minute==0))
    {digitalWrite(13, HIGH);
    delay(60000);
  Serial.println("Contacteur ouvert");}
  else{digitalWrite(13, LOW); 
  Serial.println("Contacteur fermé");
  delay(1000);
}


}

Comment alimentez vous le montage une fois que vous avez débranché l’USB ?

j'alimente en 5V sur le vin

La tension sur Vin doit être entre 7 et 12V

Je vais tester ca alors ...

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.