Change alarm time on DS3231 RTC

Hi. Using a Duemilanove 328 and a DS3231N RTC I have success in getting the the alarm time set so that when the alarm activates it is being read by the Serial Monitor but I can't work out how to write code so that the alarm time changes from the top of every hour and then at 30 minutes past and then again at the top of the hour and so on and so forth. Basically I would like the alarm to activate every half hour. I have set the code to display only the minutes on the serial monitor as I'm not interested in the days, months or years. I have indicated in the code my idea of how I thought it would work using IF statements, however the clock alarm will activate on the first alarm time set in the void setup block but my uncertainty is how to read the time from the clock as Binary or Decimal, neither of which seem to work in my IF statements. Any ideas please.
The code is here.

/*
   
 
 
 The circuit:
   RTC alarm output attached to digital pin 2 and the alarm output is +5V when cancelled and 0V when activated
   
 */
 
// constants won't change. They're used here to 
// set pin numbers:
	#include <Wire.h>
	#include <SPI.h>
	#include <RTClib.h>
	#include <RTC_DS1307.h>
	#define CLOCK_ADDRESS 0x68
        void RTC_send_register(unsigned char reg,unsigned char value)
{
  Wire.beginTransmission(CLOCK_ADDRESS);
  Wire.send(reg); 
  Wire.send(value);
  Wire.endTransmission();
}
	RTC_DS1307 RTC;
const int buttonPin = 2;     // the digital pin that the alarm output is connected to

// variables will change:
int buttonState = 0;         // variable for reading the alarm status
void setup() {
    // initialize the alarm pin as an input:
  pinMode(buttonPin, INPUT); 
   Serial.begin(9600);
	    Wire.begin();
	    RTC.begin();
RTC_send_register(0x0b,0x00);       //This line sets the minutes alarm register to 15 minutes past the hour
                 (0x0c,0x80);       // This line is required to set the alarm to activate every hour, 
                
}

void loop(){
  // read the state of the alarm output:
  buttonState = digitalRead(buttonPin);

  // check if the alarm output is high or low.
  
  if (buttonState == LOW) {     
        RTC_send_register(0x0f,0);                                   // This is to cancel the alarm flag of the RTC:                                
     delay(1000);
     
     Wire.requestFrom(CLOCK_ADDRESS, 7);
           int minute = (Wire.receive());
	 	 
	  //print the minute from the clock
	  DateTime now = RTC.now();
        
    Serial.print(now.minute(), DEC);
    Serial.println();
    Wire.endTransmission(); 
  // The following is the IF code that I assumed would set the alarm to activate at the top of every hour and then at 30 mins past 
    if (minute == 0x00) {
  RTC_send_register(0x0b,0x30);       
                 (0x0c,0x80);
} else if (minute == 0x30) {
 RTC_send_register(0x0b,0x00);       
                 (0x0c,0x80);
     }     
               
  }
}
void loop() {
  // read the state of the alarm output:
  buttonState = digitalRead(buttonPin);

  // check if the alarm output is high or low.

  if (buttonState == LOW) {     
    RTC_send_register(0x0f,0);  // This is to cancel the alarm flag of the RTC:                                
    delay(1000);

    Wire.requestFrom(CLOCK_ADDRESS, 7);  // ??? Why request 7 bytes and read only one?
    int minute = (Wire.receive());

    //print the minute from the clock
    DateTime now = RTC.now();

    Serial.print(now.minute(), DEC);
    Serial.println();
    Wire.endTransmission();  //  ????  Where is the matching Wire.beginTransmission()??? 
   
    // The following is the IF code that I assumed would set the alarm to activate at the top of every hour and then at 30 mins past 
    if (minute == 0x00) {
      RTC_send_register(0x0b,0x30);       
      (0x0c,0x80);  // ???? What do you expect this statement to do?
    } 
    else if (minute == 0x30) {
      RTC_send_register(0x0b,0x00);       
      (0x0c,0x80);  // ???? What do you expect this statement to do?
    }
  }
}

void loop() {
// read the state of the alarm output:
buttonState = digitalRead(buttonPin);

// check if the alarm output is high or low.

if (buttonState == LOW) {
RTC_send_register(0x0f,0); // This is to cancel the alarm flag of the RTC:
delay(1000);

Wire.requestFrom(CLOCK_ADDRESS, 7); // ??? Why request 7 bytes and read only one? It was in the original code to give year, month, day, hour etc. I left it as it is to avoid inducing any problems.
int minute = (Wire.receive());

//print the minute from the clock
DateTime now = RTC.now();

Serial.print(now.minute(), DEC);
Serial.println();
Wire.endTransmission(); // ???? Where is the matching Wire.beginTransmission()??? Six lines up, Wire.requestFrom(CLOCK_ADDRESS,7);

// The following is the IF code that I assumed would set the alarm to activate at the top of every hour and then at 30 mins past
if (minute == 0x00) {
RTC_send_register(0x0b,0x30);
(0x0c,0x80); // ???? What do you expect this statement to do? It is to set the alarm for every hour, without it the alarm works once only.
}
else if (minute == 0x30) {
RTC_send_register(0x0b,0x00);
(0x0c,0x80); // ???? What do you expect this statement to do? It is to set the alarm for every hour, without it the alarm works once only.
}
}
}

Set the alarm to go off every minute. When it goes off, read the minutes value from the clock. If it is zero or thirty do whatever needs to be done, otherwise ignore it.

Pete

      (0x0c,0x80);

This statement does nothing. It is valid C++ code but it doesn't call any functions or have any side-effects so it is likely just optimized away. From the context it appears that you intended to say:

      RTC_send_register(0x0c,0x80);

THAT statement is a function call.

el-supremo, johnwasser thanks for the input chaps. I hadn't thought about triggering every minute but it still leaves me with the problem of not being able to read the data from the clock. As you will see in my first post I have tried to incorporate it into the IF statement as Hex but I have tried BCD and Decimal as well but neither way seems to work. The data sheet indicates BCD. As far as setting the time, setting the alarm and getting the alarm output to go low and then cancelling it the whole thing works fine. I can get all of the time, date, month etc up on the serial monitor so I know that part of it works well. It's just this part in the IF statement that I can't figure out. How to get it to read the present time when the alarm is triggered. It's only that part that I can't get to work. The layout of the IF statement looks OK to me. Any ideas?

John has already pointed out the major error in your code. You need to request only ONE byte, not seven, because you only actually read one byte.

Pete