Beginner advise on previously working code

Hello, all. Was involved 2 years ago with arduino coding and managed to draft something that was running. It was a basic I2C, Temp and RTC. Now I want to expand the code with PWM LED control but something is strange with the code.
There is the code:

 ---#include <Time.h> 
#include <Wire.h> 
#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t
#include <LiquidCrystal_I2C.h>
#include <OneWire.h> 


int DS18S20_Pin = 2;
OneWire ds(DS18S20_Pin);
LiquidCrystal_I2C lcd(0x3F, 20, 4);


void setup(void)  {
  lcd.begin(20, 4);
  lcd.backlight();
  lcd.init();

  Serial.begin(9600);
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if(timeStatus()!= timeSet)
     Serial.println("Unable to sync with the RTC");
  else
     Serial.println("RTC has set the system time");
    
}

void loop(void)
{
   digitalClockDisplay(); 
   delay(1000);
}
{
  float temperature = getTemp();
  Serial.println(temperature);
  lcd.setCursor(0, 0);
  lcd.print("Temp:");
  lcd.setCursor(5,0); 
  lcd.print(temperature);
  lcd.setCursor(10, 0);
  lcd.print((char)223);
  lcd.setCursor(11, 0);
  lcd.print("C");
  
  delay(1000);
}


float getTemp(){
  

  byte data[12];
  byte addr[8];

  if ( !ds.search(addr)) {
      
      ds.reset_search();
      return -1000;
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return -1000;
  }

  if ( addr[0] != 0x10 && addr[0] != 0x28) {
      Serial.print("Device is not recognized");
      return -1000;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44,1); // start conversion, with parasite power on at the end

  byte present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE); // Read Scratchpad

  
  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  }
  
  ds.reset_search();
  
  byte MSB = data[1];
  byte LSB = data[0];

  float tempRead = ((MSB << 8) | LSB); //using two's compliment
  float TemperatureSum = tempRead / 16;
  
  return TemperatureSum;
  
}


void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year());
  Serial.println();
 
lcd.setCursor(0, 0);                                            // Set LCD cursor position (column, row)
lcd.print(hour());
lcd.print(":");
lcd.print (minute());
lcd.print(":");
lcd.print(second());


// Print text to LCD
                                     // Delay to read text
                               // Clear the display

}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}


--- End code ---


Nice. The link from the first answer helped me, but still receiving the same error on line 32. :)

DrAzzy: 

--- Code: ---void loop(void)
{
   digitalClockDisplay(); 
   delay(1000);
}   //here's the
{   //problem
  float temperature = getTemp();
  Serial.println(temperature);
  lcd.setCursor(0, 0);
  lcd.print("Temp:");
  lcd.setCursor(5,0); 
  lcd.print(temperature);
  lcd.setCursor(10, 0);
  lcd.print((char)223);
  lcd.setCursor(11, 0);
  lcd.print("C");
  
  delay(1000);
}

Why I'm receiving an error on: lcd.int()?
Has something changed?
Thank you in advance for the cooperation :slight_smile:

Why I'm receiving an error on: lcd.int()?

Because there's no such thing as lcd.int?

Was it really so much trouble to post the actual error message?

void loop(void)
{
   digitalClockDisplay(); 
   delay(1000);
}
{

oops

Oops sorry missed the errors :frowning: My bad. There it is :

Arduino: 1.8.0 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\ganev\Documents\Arduino\ga\ga.ino:10:34: warning: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]

LiquidCrystal_I2C lcd(0x3F, 20, 4);

^

In file included from C:\Users\ganev\Documents\Arduino\ga\ga.ino:4:0:

C:\Users\ganev\Documents\Arduino\libraries\NewliquidCrystal/LiquidCrystal_I2C.h:53:4: note: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)'

LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);

^

C:\Users\ganev\Documents\Arduino\libraries\NewliquidCrystal/LiquidCrystal_I2C.h: In function 'void setup()':

C:\Users\ganev\Documents\Arduino\libraries\NewliquidCrystal/LiquidCrystal_I2C.h:154:9: error: 'int LiquidCrystal_I2C::init()' is private

int init();

^

ga:16: error: within this context

lcd.init();

^

C:\Users\ganev\Documents\Arduino\ga\ga.ino: At global scope:

ga:32: error: expected unqualified-id before '{' token

{

^

ga:132: error: expected unqualified-id before '--' token

--- End code ---

^

ga:144: error: expected unqualified-id before '{' token

{ //problem

^

exit status 1
within this context

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Well,
You have typed void in void loop n I think thts causing all the trouble. Just remove n see

smashingblaster:
Well,
You have typed void in void loop n I think thts causing all the trouble. Just remove n see

Rubbish.
Look where loop starts, and where it ends,

Oh ya, dint see really sorry