How this cute.play to bound Hourly? i.e when H=1, it plays only once and when Hour is 2 it plays two times only and so on.
// base sketch from https://brainy-bits.com/tutorials/4-bits-7-segment-led-display-with-arduino/
// changed TM1637 library by niq_ro for degree, r & h letter
// DS3231 clock on TM1637 LED display by niq_ro from http://www.tehnic.go.ro
// & http://arduinotehniq.com/
#include "TM1637.h"
#include <CuteBuzzerSounds.h>
//{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
//0~9,A,b,C,d,E,F,"-"," ",degree,r,h
/*
- Author: Everton Ramires
- More Tutorial: https://www.youtube.com/channel/UC7zG4YQJc8v-9jNGQknOx5Q
CURRENT SOUND OPTIONS:
(PT-BR)OPÇÕES ATUAIS DE SONS:
S_CONNECTION S_DISCONNECTION S_BUTTON_PUSHED
S_MODE1 S_MODE2 S_MODE3
S_SURPRISE S_OHOOH S_OHOOH2
S_CUDDLY S_SLEEPING S_HAPPY
S_SUPER_HAPPY S_HAPPY_SHORT S_SAD
S_CONFUSED S_FART1 S_FART2
S_FART3 S_JUMP20
*/
#define CLK 9//Pins for TM1637
#define DIO 8
TM1637 tm1637(CLK,DIO);
#define BUZZER_PIN 3
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
int hh, mm;
void setup()
{
tm1637.init();
tm1637.set(5);
//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
rtc.begin();
// manual adjust
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
// automatic adjust
//rtc.adjust(DateTime(F(DATE), F(TIME)));
//pinMode(13, OUTPUT);
cute.init(BUZZER_PIN);
}//end "setup()"
void loop(){
DateTime now = rtc.now();
hh = now.hour(), DEC;
mm = now.minute(), DEC;
tm1637.point(POINT_OFF);
tm1637.display(0,hh/10); // hour
tm1637.display(1,hh%10);
tm1637.display(2,mm/10); // minutes
tm1637.display(3,mm%10); //
delay(500);
tm1637.point(POINT_ON);
tm1637.display(0,hh/10); // hour
tm1637.display(1,hh%10);
tm1637.display(2,mm/10); // minutes
tm1637.display(3,mm%10); //
delay(500);
if( hh <=24 && (mm == 00 || mm == 00)) //Comparing the current time with the Alarm time{
//digitalWrite(13,HIGH);
// delay (9000);
// digitalWrite (13,LOW);
cute.play( S_MODE3 ); How this cute.play to bound Hourly i.e when H=1, it plays only once and when Hour is 2 it plays two times only and so on.
delay(2000);
}// end loop()
RTC_TM1637_spkfinal2.ino (2.22 KB)