Hello guys.
have a nice day.
my name is Thanh.
please help me with this issue.
currently i'm trying to create a library (actually this is my first lib ) for the DS3231 timer.
while im uploading code i got this issue:
C:\Program Files (x86)\Arduino\libraries\DS3231\DS3231.cpp:22:6: error: prototype for 'byte DS3231Timer::convertBCDtoDEC(byte)' does not match any in class 'DS3231Timer'
byte DS3231Timer::convertBCDtoDEC(byte x){
   ^
In file included from C:\Program Files (x86)\Arduino\libraries\DS3231\DS3231.cpp:1:0:
C:\Program Files (x86)\Arduino\libraries\DS3231\DS3231.h:27:6: error: candidate is: int DS3231Timer::convertBCDtoDEC(byte)
 int convertBCDtoDEC(byte x) {return b;}
   ^
exit status 1
Error compiling for board Arduino Pro or Pro Mini.
seem that i the problem comes from this function "byte DS3231Timer::convertBCDtoDEC(byte x)"
what i wanna do is send number in BIN and this function with return the DEC number.
additonal info: i used arduino nano + FTDI
here is header file .h
#include "Arduino.h"
#include "pins_arduino.h"
#include "Wire.h"
//DS3231 address
#define DS3231 0x68
#define secs 0x00
#define mins 0x01
#define hrs 0x02
#define months 0x03
#define years 0x04
class DS3231Timer{
public:
int getSecs() ; //this function is used to get second data
void getMins(); //this function is used to get minute data
void getHrs (uint8_t types); // this function is used to get Hour data
void getPeriod(); // this function is used to get period of day. AM or PM if set it 12h mode.
int convertBCDtoDEC(byte x) {return b;}
//byte convertDECtoBCD(int x) {return dectobcd;}
protected:
int k;
byte b;
};
and .ccp file
#include "DS3231.h"
#include "Arduino.h"
#include "pins_arduino.h"
#include "Wire.h"
int DS3231Timer::getSecs(){
Wire.beginTransmission(DS3231);
Wire.write(secs);
Wire.endTransmission();
int k = convertBCDtoDEC(Wire.read());
return k;
}
int DS3231::convertDECtoBCD(byte x){
int result;
int MBS = x >> 4;
int LBS = x & 0b1111;
return result = (MBS*10)+LBS;
}
byte DS3231Timer::convertBCDtoDEC(byte x){
 int result;
 int MBS = x >> 4;
 int LBS = x & 0b1111;
 return result = (MBS*10)+LBS;
}
and here is the code that i write in arduino IDE in order to test simple function.
#include "DS3231.h"
DS3231Timer timer;
void setup(){
 Serial.begin(9600);
}
void loop(){
Â
 Serial.println(timer.getSecs());
Â
}
full picture when i got this error:
the question is how do i fix it?
i thinks it's too simple for person writes the library very day
but to me it's huge problem :o :o :o
Thank you so much for caring about my topic
anyway, my email is :nhatthanh228@gmail.com
if there is any infor please update here