To be able to schedule an action for given time and also repeat

Try this

#include "TimeAlarms/TimeAlarms.h"

const int led2 = D7;

void setup()
{
  #if (PLATFORM_ID==6)  // for Photon Time issue
  while(Time.year() < 2000) Spark.process(); // wait for Time to sync
  #endif

  int hh = Time.hour();        // to test for next minute
  int mm = Time.minute();

  pinMode(led2, OUTPUT);

  mm++;            // set for next minute
  Alarm.alarmRepeat(hh  , mm, 0,  ONAlarm);
  mm += 5;         // set for five min later
  hh += (mm / 60); // take care of mm/hh overflows
  mm %= 60;
  hh %= 24;
  Alarm.alarmRepeat(hh, mm, 0, OFFAlarm); 
}

void ONAlarm()
{
    digitalWrite(led2, HIGH);   
}

void OFFAlarm()
{
    digitalWrite(led2, LOW);   
}

void loop()
{
  Alarm.delay(1000);
}

But maybe we want to consult @bko to confirm TimerAlarms do work on Photon.