Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

Digital Clock with Stopwatch, Alarm, Countdown and Temperature Display Using Arduino and RTC DS1307

Description

Comments

cheeky

nice one

What is add = 11 and why has it been initialized with 11?

Congratulations!! It's a great job.

Hi, can somebody modify my code to work successfully? 

I want to select specific mp3 files saved in the SD card, but my code just select the first file eventhough i specify mp3_play (3);

Also i just don't know what value and syntax in the alarm.once(make_t value).

Thanks in advance.

 

 

<code>#include <DS3231.h>

Time  t;
AlarmId id;
 
 
#define buz 9
#define buzz 12
#define boz 8
const int buzzer = 12; //buzzer to arduino pin 9
 
 
int Hor;
int Min;
int Sec;
        
 
void setup() 
 
 Serial.begin (9600);
 mp3_set_serial (Serial); 
 mp3_set_volume (15);
 
 
  
  
 Wire.begin(); 
 rtc.begin();
 lcd.begin(16,2); 
 Serial.begin(9600);
 setTime(23,20,0,10,18,17);
 pinMode(buz, OUTPUT);
 pinMode(buzz, OUTPUT); 
 pinMode(boz, OUTPUT); 
}
 
void loop() {
  t = rtc.getTime();
  Hor = t.hour;
  Min = t.min;
  Min = t.min;
  
      
   
 lcd.setCursor(0,0);
 lcd.print("Time: ");
 lcd.print(rtc.getTimeStr());
 lcd.setCursor(0,1);
 lcd.print("Time: ");
 lcd.print(rtc.getTimeStr());
 delay(1000);
 lcd.setCursor(0,1);
 lcd.print("Date: ");
 lcd.print(rtc.getDateStr());
 delay(1000);
 lcd.setCursor(0,1);
 lcd.print("Day: ");
 lcd.print(rtc.getDOWStr());
 lcd.print("           ");
 delay(1000);
 lcd.setCursor(0,1);
 lcd.print("Temp: ");
 lcd.print(rtc.getTemp());
 lcd.print(" C");
 lcd.print("          ");
 
 
  // create the alarms, to trigger at specific times
  Alarm.alarmRepeat(7,0,0, MorningAlarm);  // 8:30am every day
 
  Alarm.timerOnce(10, OnceOnly);            // called once after 10 seconds
   Alarm. triggerOnce(time_t value,  explicitAlarm); // value specifies a date and time
//(See the makeTime() method in the Time library to convert dates and times into time_t)
 
 
 
  digitalClockDisplay();
  Alarm.delay(1000); // wait one second between clock display
 
}
// functions to be called when an alarm triggers:
void MorningAlarm() {
  Serial.println("Alarm: - turn lights off");
  void Buzzer();
  mp3_play ();
  delay (2000);
 
}
 
void EveningAlarm() {
  Serial.println("Alarm: - turn lights on");
    void Buzzer();
  mp3_play ();
  delay (2000);
 
 
}
void WeeklyAlarm() {
  Serial.println("Alarm: - its Monday Morning");
  void Buzzer();
 
    
}
 
void ExplicitAlarm() {
  Serial.println("Alarm: - this triggers only at the given date and time");
}
 
 
void Repeats() 
{
 Serial.println("15 second timer");
 
 
 void Buzzer();
 
}
 
void Repeats2() {
  Serial.println("2 second timer");
   void Buzzer();
 
  digitalWrite(buz,HIGH);
  delay(1000);
  digitalWrite(buz, LOW);
  tone(buzzer, 3000); // Send 1KHz sound signal...
  delay(50);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(50);        // ...for 1sec
  tone(buzzer, 3000); // Send 1KHz sound signal...
  delay(50);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(50);        // ...for 1sec
  tone(buzzer, 3000); // Send 1KHz sound signal...
  delay(50);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(50);        // ...for 1sec
  tone(buzzer, 3000); // Send 1KHz sound signal...
  delay(50);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(50);        // ...for 1sec
}
 
 
 
 
 
void OnceOnly() {
  Serial.println("This timer only triggers once, stop the 2 second timer");
  // use Alarm.free() to disable a timer and recycle its memory.
  Alarm.free(id);
  // optional, but safest to "forget" the ID after memory recycled
  id = dtINVALID_ALARM_ID;
  // you can also use Alarm.disable() to turn the timer off, but keep
  // it in memory, to turn back on later with Alarm.enable().
}
 
void digitalClockDisplay() {
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.println();
}
 
void printDigits(int digits) {
  Serial.print(":");
  if (digits < 10)
    Serial.print('0');
  Serial.print(digits);

}</code>

I am getting below mentioned error while uploading the code : -

 

 
 
 
 
 
 
 
 
 
 
sketch_oct26e:21: error: no matching function for call to 'DHT::DHT()'
 
 DHT DHT;
 
     ^
 
C:\Users\Mahendra\Documents\Arduino\sketch_oct26e\sketch_oct26e.ino:21:5: note: candidates are:
 
In file included from C:\Users\Mahendra\Documents\Arduino\sketch_oct26e\sketch_oct26e.ino:4:0:
 
C:\Users\Mahendra\Documents\Arduino\libraries\DHT/DHT.h:40:4: note: DHT::DHT(uint8_t, uint8_t, uint8_t)
 
    DHT(uint8_t pin, uint8_t type, uint8_t count=6);
 
    ^
 
C:\Users\Mahendra\Documents\Arduino\libraries\DHT/DHT.h:40:4: note:   candidate expects 3 arguments, 0 provided
 
C:\Users\Mahendra\Documents\Arduino\libraries\DHT/DHT.h:38:7: note: constexpr DHT::DHT(const DHT&)
 
 class DHT {
 
       ^
 
C:\Users\Mahendra\Documents\Arduino\libraries\DHT/DHT.h:38:7: note:   candidate expects 1 argument, 0 provided
 
C:\Users\Mahendra\Documents\Arduino\libraries\DHT/DHT.h:38:7: note: constexpr DHT::DHT(DHT&&)
 
C:\Users\Mahendra\Documents\Arduino\libraries\DHT/DHT.h:38:7: note:   candidate expects 1 argument, 0 provided
 
C:\Users\Mahendra\Documents\Arduino\sketch_oct26e\sketch_oct26e.ino: In function 'void loop()':
 
sketch_oct26e:55: error: 'class DHT' has no member named 'read11'
 
   int chk = DHT.read11(DHT11_PIN);
 
                 ^
 
sketch_oct26e:136: error: 'class DHT' has no member named 'humidity'
 
   lcd.print(DHT.humidity);
 
                 ^
 
sketch_oct26e:141: error: 'class DHT' has no member named 'temperature'
 
   lcd.print(DHT.temperature);
 
                 ^
 
exit status 1
no matching function for call to 'DHT::DHT()'
 

Please suggest 

where is dht.h file 

When I compile the program then #include Adafruit_sensor.h error message! Please suggest it's remedy