Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends, can you please advise me? I compiled the datalogger according to the instructions.
Temperature Sensor for Arduino Applied for COVID 19 : 12 Steps (with Pictures) - Instructables[^]
It reports these errors to me during compilation. I have tried to use different libraries for DS1307, but the result is always the same. I can't program, so I don't know what's wrong. Thank you for your willingness.

E:\1\sketch_nov17b\sketch_nov17b.ino: In function 'void updateHour()':
sketch_nov17b:39:13: error: expected unqualified-id before '.' token
       DS1307.getDate(DataTime);
             
sketch_nov17b:43:19: error: 'times' was not declared in this scope
           sprintf(times, "%02d:%02d", DataTime[4], DataTime[5]);




part of the code:


C++
int DataTime[7];

void updateHour()

{

DS1307.getDate(DataTime);

if(DataTime[5] != minUpdate)

{

sprintf(times, "%02d:%02d", DataTime[4], DataTime[5]);

lcd.setCursor(0,0);

lcd.print(" ");

lcd.setCursor(5,0);

lcd.print(times);

minUpdate = DataTime[5];

}

}


What I have tried:

I have tried to use different libraries for DS1307, but the result is always the same.
Posted
Updated 13-Jul-22 6:38am
v6
Comments
Richard MacCutchan 23-Nov-21 14:09pm    
What is DS1307 on line 39? And you have not declared times in the updateHour method, so what value are you expecting to reference?

This was an old question but this might be the solution to that
Maybe

......

int DataTime[7];
DS1307 rtc;               //this should be declare like here
char times[32];           //the array containing the string of time should also be declared

void updateHour()
{
      rtc.getDate(DataTime); //use the "rtc" intstead of "DS1307.getDate(DataTime);"
      
      if(DataTime[5] != minUpdate)
      {
         sprintf(times, "%02d:%02d", DataTime[4], DataTime[5]);

......
 
Share this answer
 
I'm sending part of the code from line 1 to the first error. I used the code as it is on the site, see the link.

https://www.instructables.com/Temperature-Sensor-for-Arduino-Applied-for-COVID-1


C++
#include <dallastemperature.h> //Library with all function of DS18B20 Sensor
#include <ds1307.h>
#include <liquidcrystal_i2c.h> //Biblioteca I2C do LCD 16x2
#include <wire.h> //Biblioteca de Comunicacao I2C 
#include <onewire.h> //OneWire Library for DS18B20 Sensor
#include <sd.h>
#include <spi.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // Configurando o endereco do LCD 16x2 para 0x27

#define ONE_WIRE_BUS 8 //Digital Pin to connect the DS18B20 Sensor

//Define uma instancia do oneWire para comunicacao com o sensor
OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);
DeviceAddress sensor1;

File myFile;

#define Buttonmeasure 2
#define Buttonadjusthour 3
#define Buttonok 4

bool measure = 0, adjusthour = 0, ok = 0;
bool measure_state = 0, adjusthour_state = 0, ok_state = 0;
bool measure_process = 0, adjust_process = 0;

byte actualMin = 0, previousMin = 0;
byte actualHour = 0, previousHour = 0;
byte minUpdate = 0;

int pinoSS = 10; // Pin 53 para Mega / Pin 10 para UNO

int DataTime[7];

void updateHour()
{
      DS1307.getDate(DataTime);
      
      if(DataTime[5] != minUpdate)
      {
          sprintf(times, "%02d:%02d", DataTime[4], DataTime[5]);
          
          lcd.setCursor(0,0);
          lcd.print("                ");
          lcd.setCursor(5,0);
          lcd.print(times);
          
          minUpdate = DataTime[5];
      }
      
}
 
Share this answer
 
v2
Comments
Richard Deeming 24-Nov-21 3:49am    
If you want to update your question, click the green "Improve question" link and update your question.

Do not post your update as a "solution" to your question.
Richard MacCutchan 24-Nov-21 3:52am    
But you have still not answered my question from yesterday. Where is DS1307 defined, and what is it? And where is the variable times declared?
I'm sorry, I can't program, I used the finished code from the site:
https://www.instructables.com/Temperature-Sensor-for-Arduino-Applied-for-COVID-1/
I know there is a problem with the code for the RTC module (1307), but I can't fix the code error.
Can you please look at the site where the whole code is?
Thank you very much for your willingness.
 
Share this answer
 
Comments
Richard MacCutchan 24-Nov-21 12:15pm    
If you get code from some other site and it does not work, then you need to go back to that site and report it there.
Richard Deeming 24-Nov-21 12:24pm    
Once again: DO NOT post comments or updates as "solutions" to your question!
mira mira 27-Nov-21 14:57pm    
I'm sorry because I can't program, I used the finished code from the site, bought the components .. and nothing.
No one has answered the site for a year, so I asked for advice on this forum.
The first error on line 39 is related to the DS1307.h library, but I can't do it anymore. You see a mistake there, maybe just a dot is missing somewhere, a semicolon ... I don't know.
Thank you very much for your willingness.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900