DS3231 Aa question about sqw

Hi i am using a ds3231 as an interrupt, at the output of the sqw it is always 5 volt , when time match with the alarm i get 0 volts for about a second(i get the interrupt ) and then hight again until the next match time . Is there a way from low and when time match go high. Thanks

#include <Wire.h>
#include <DS3231.h>

DS3231 clock;
RTCDateTime dt;
boolean isAlarm  = false;


void alarm()
{
  Serial.println("interupt");
  isAlarm = true;
}

void setup()
{
  Serial.begin(9600);

  
  Serial.println("Starting DS3231");;
  clock.begin();
clock. enable32kHz(false);
clock.enableOutput(false);
  // Set sketch compiling time
clock.setDateTime( __DATE__, __TIME__); 
delay(1000);
clock.setAlarm1(0, 0, 0,5, DS3231_MATCH_S);
attachInterrupt(0, alarm, FALLING);
}


void loop()
{
  dt = clock.getDateTime();
if (isAlarm)
{
  clock.clearAlarm1();
}
  // For leading zero look to DS3231_dateformat example

  Serial.print("Raw data: ");
  Serial.print(dt.year);   Serial.print("-");
  Serial.print(dt.month);  Serial.print("-");
  Serial.print(dt.day);    Serial.print(" ");
  Serial.print(dt.hour);   Serial.print(":");
  Serial.print(dt.minute); Serial.print(":");
  Serial.print(dt.second); Serial.println("");

  delay(1000);
}

Is there a way from low and when time match go high

Why do you want to do this ?

By the way, you should not use Serial.print() in an ISR because interrupts are automatically disabled and Serial used interrupts

Hi i am makeing a sketch that the rtc will interuppt every 12 hours and exequte a code .

Can we have some background?

How soon after the 12 hour event do you need to execute your code? Because, normally interrupts are only used when events like this need swift (as in microsecond time) handling.

Is this an academic (i.e. learning) exercise, or a project that someone will use? If you are just opening a chicken coop door or something like that which takes seconds to complete, you are much better off avoiding the interrupts and just poll the RTC status flags instead.

Concerning your original question, you can choose any polarity you like for interrupt pins. So it should make no difference whether SQW goes HIGH or LOW when active.

Hi i am trying to make a dht to send temperature to a gsm (sms) , every 12 hours ,becouse with arduino mill is not accurate

So configure an interrupt pin for the falling edge. Wait a minute, you did. So a LOW on the interrupt pin from the SQW output is perfect. So what is your problem?

Hi ,my question is can a ds3231 (sqw)go from low to hight (hight when gets interoppt)

JOHN_1973: Hi ,my question is can a ds3231 (sqw)go from low to hight (hight when gets interoppt)

I know that is your question. My question to you, why do you need that? Actually, it was the first question asked in reply #1 and you haven't directly answered it.

You may as well "lay your cards down" because the DS3231 can't do what you ask. Maybe we can help you solve the problem (assuming there really is one) with some other solution.

Hi , do you mean that as an interoppt to from ds3231 the arduino will not exequte properly. as an e.x useing a interuppt pin 2, puting the arduino in sleep mode ,waiting to geting a puls 0 or 1 from ds3231 every 12 hours . in the interuppt will exequte (read dth write it to gsm, gsm sends sms).Is it going to work properly.

I have woken up an Adrduino (ATmeag328P) from deep sleep using the the falling edge of the INT on the DS3231.

I dont see the problem with that.

You cannot make the DS3231 pin go high on Alarm (hint: read the datasheet), but you dont need to.

o.k thanks for replys