Go Down

Topic: DS1307 RTC Does not name a type (Read 11608 times) previous topic - next topic

acosicdm

Well I just this minute compiled both SetTime and ReadTest in DS1307RTC's Examples folder and they're clean.

I can't run them right now since my Uno is busy logging the temp and humidity as a test but I know they both work, I used them recently.
Anymore DS1307 Library? I cannot compile it. Or what does that error means? I just really need this for my final project.

UKHeliBob

What do you mean sir?  Sorry I don't get it. I'm Just new in using arduino.
Read this Installing Arduino libraries
Is the DS1307 library in the correct folder for your Operating System and does it have the correct name ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

acosicdm

Does this help?

It looks like the library didn't get included or compiled properly. Is it showing any other errors? Fix those and it will probably work.

No other errors. What should I do? or do you have any library for RTC DS1307. Thaanks

acosicdm

Read this Installing Arduino libraries
Is the DS1307 library in the correct folder for your Operating System and does it have the correct name ?
I just read the Libraries installation. And my library was properly installed and correct. In fact my other downloaded libraries work.

JimboZA

#19
Dec 14, 2014, 04:42 pm Last Edit: Dec 14, 2014, 04:43 pm by JimboZA
If you have your library declared like this....

Code: [Select]
#include <DS1307RTC.h>

....try this:

Code: [Select]
#include "DS1307RTC.h"

(Or the other way round.)

Where you have installed, ie the sketchbook or the Arduino install folder, matters.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

UKHeliBob

Hold on a moment !  You included the library like this
Code: [Select]
#include "DS1307.h"
so even if it is in the right place the sketch will not find it because it is expecting it to be in the same folder as the sketch using that form of include.
Use
Code: [Select]
#include <DS1307.h>
and the sketch will look in the correct folder.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

acosicdm

If you have your library declared like this....

Code: [Select]
#include <DS1307RTC.h>

....try this:

Code: [Select]
#include "DS1307RTC.h"

(Or the other way round.)

Where you have installed, ie the sketchbook or the Arduino install folder, matters.
It really don't work. "was not declared in this scope"  

acosicdm

Hold on a moment !  You included the library like this
Code: [Select]
#include "DS1307.h"
so even if it is in the right place the sketch will not find it because it is expecting it to be in the same folder as the sketch using that form of include.
Use
Code: [Select]
#include <DS1307.h>
and the sketch will look in the correct folder.
I tried both
#include <DS1307.h>
#include "DS1307.h"

Still don't work sir

UKHeliBob

I tried both
#include <DS1307.h>
#include "DS1307.h"

Still don't work sir
OK, let's go back to previous questions.  Based on the link I gave you previously where exactly is the DS1307 library installed, what is the exact name of the folder that it is in and what files does that folder contain ?

I know that you say that it is in the right place but the symptoms that you describe make it sound like it is in the wrong place or has the wrong name,  Note that upper/lowercase matters when it comes to the names.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Faiq78298

hello guys i have problem with my code i think there is library problem. i am not able to find library for the following code also error MSG showing Rtc_ds1307 doesn't make name a type.



#include <Wire.h>
#include<EEPROM.h>
#include <RTClib.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
RTC_DS1307 RTC;
int temp,inc,hours1,minut,add=11;
int next=10;   
int INC=9;
int set_mad=8;

#define buzzer 13

int HOUR,MINUT,SECOND;

void setup()
{
 Wire.begin();
 RTC.begin();
 lcd.begin(16,2);
 pinMode(INC, INPUT);
 pinMode(next, INPUT);
 pinMode(set_mad, INPUT);
 pinMode(buzzer, OUTPUT);

   lcd.setCursor(0,0);
   lcd.print("Medicin reminder");
   lcd.setCursor(0,1);
   lcd.print(" Using Arduino  ");
    delay(2000);
    lcd.setCursor(0,0);
   lcd.print("By Saddam khan  ");
   lcd.setCursor(0,1);
   lcd.print("Engineers Garage");
    delay(2000);

 if(!RTC.isrunning())
 {
 RTC.adjust(DateTime(__DATE__,__TIME__));
 }
}

void loop()
{
   int temp=0,val=1,temp4;
   DateTime now = RTC.now();
   if(digitalRead(set_mad) == 0)      //set medicine time
   {
     lcd.setCursor(0,0);
   lcd.print("  Set Medicine  ");
   lcd.setCursor(0,1);
   lcd.print("  Reminder time ");
    delay(2000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Enter Time 1");
    defualt();
    time(1);
    delay(1000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Enter Time 2");
    defualt();
    delay(1000);
    time(2);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Enter Time 3");
    defualt();   
time(3);
     lcd.setCursor(0,0);
   lcd.print("Medicin reminder");
   lcd.setCursor(0,1);
   lcd.print("  time has set  ");
    delay(2000);
 }
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("Time:");
 lcd.setCursor(6,0);
 lcd.print(HOUR=now.hour(),DEC);
 lcd.print(":");
 lcd.print(MINUT=now.minute(),DEC);
 lcd.print(":");
 lcd.print(SECOND=now.second(),DEC);
 lcd.setCursor(0,1);
 lcd.print("Date: ");
 lcd.print(now.day(),DEC);
 lcd.print("/");
 lcd.print(now.month(),DEC);
 lcd.print("/");
 lcd.print(now.year(),DEC);
 match();
 delay(200);
}

void defualt()
{
  lcd.setCursor(0,1);
  lcd.print(HOUR);
  lcd.print(":");
  lcd.print(MINUT);
  lcd.print(":");
  lcd.print(SECOND);
}

/*Function to set alarm time and feed time into Internal eeprom*/

void time(int x) 
{
  int temp=1,minuts=0,hours=0,seconds=0;
    while(temp==1)
    {
     if(digitalRead(INC)==0)
     {
      HOUR++;
      if(HOUR==24)
      {
       HOUR=0;
      }
      while(digitalRead(INC)==0);
     }     
lcd.clear();
      lcd.setCursor(0,0);
    lcd.print("Enter Time ");
   lcd.print(x);
    lcd.setCursor(0,1);
    lcd.print(HOUR);
    lcd.print(":");
    lcd.print(MINUT);
    lcd.print(":");
    lcd.print(SECOND);
    delay(100);
    if(digitalRead(next)==0)
    {
      hours1=HOUR;
      EEPROM.write(add++,hours1);
     temp=2;
     while(digitalRead(next)==0);
    }
    }
    while(temp==2)
    {     
if(digitalRead(INC)==0)
     {
      MINUT++;
      if(MINUT==60)
      {MINUT=0;}
      while(digitalRead(INC)==0);
     }
      lcd.clear();
      lcd.setCursor(0,0);
    lcd.print("Enter Time ");
   lcd.print(x);
    lcd.setCursor(0,1);
    lcd.print(HOUR);
    lcd.print(":");
    lcd.print(MINUT);
    lcd.print(":");
    lcd.print(SECOND);
    delay(100);
      if(digitalRead(next)==0)
      {
       minut=MINUT;
       EEPROM.write(add++, minut);
       temp=0;
       while(digitalRead(next)==0);
      }
    }
    delay(1000);
}


/* Function to chack medication time */

void match()
{
  int tem[17];
  for(int i=11;i<17;i++)
  {
    tem=EEPROM.read(i);
 }
  if(HOUR == tem[11] && MINUT == tem[12])
  {
   beep();
   beep();
   beep();
   beep();
   lcd.setCursor(0,0);
   lcd.print("  Take Group One  ");
   lcd.setCursor(0,1);
   lcd.print("     Medicine     ");
   beep();
   beep();
   beep();
   beep();
  }

   if(HOUR == tem[13] && MINUT == tem[14])
   {
      beep();
   beep();
   beep();
   beep();
    lcd.setCursor(0,0);
   lcd.print("  Take Group Two  ");
   lcd.setCursor(0,1);
   lcd.print("     Medicine     ");
    beep();
   beep();
   beep();
   beep();
   }


   if(HOUR == tem[15] && MINUT == tem[16] )
   { 
     beep();
   beep();
   beep();
   beep();
    lcd.setCursor(0,0);
   lcd.print("Take Group Three ");
   lcd.setCursor(0,1);
   lcd.print("     Medicine    ");
   beep();
   beep();
   beep();
   beep();
   }
}

/* function to buzzer indication */

void beep()
{
   digitalWrite(buzzer,HIGH);
   delay(500);
   digitalWrite(buzzer, LOW);
   delay(500);
}

Go Up