Creating Libraries HELP!!!
hi i'm new whole programming thing little on library i'm trying create.
i have made sketch displaying time in 12 hour format. (not difficult know ha ha). create library clock function operates in background , can display time calling lcd.print(hours(or minutes or seconds)) in main sketch of whatever program. here cpp file:
/*
clock.cpp - library simple clock display
12 hour format
call on integers hours minutes & seconds use
*/
#include <wprogram.h>
#include <clock.h>
clock::clock(unsigned int hours)
{
_hours=hours;
}
clock::clock(unsigned int minutes)
{
_minutes=minutes;
}
clock::clock(unsigned int seconds)
_seconds=seconds;
}
void clock::clockfunction()
{
_seconds=++_seconds;
if(_seconds==60)
{ _seconds=0;}
if(_seconds==0)
{_minutes=++_minutes;}
if(_minutes==60)
{_minutes=0;
_hours=++_hours;}
if(_hours==13)
{_hours=01;}
delay (1000);
}
and here header file.
#ifndef clock
#define clock
#include <wprogram.h>
class clock
{
public:
clock (unsigned int hours);
clock (unsigned int minutes);
clock (unsigned int seconds);
void clockfunction;
private:
unsigned int _hours;
unsigned int _minutes;
unsigned int _seconds;
};
#endif
can enlighten me going wrong here? won't compile when try make example file library
any appreciated
i have made sketch displaying time in 12 hour format. (not difficult know ha ha). create library clock function operates in background , can display time calling lcd.print(hours(or minutes or seconds)) in main sketch of whatever program. here cpp file:
/*
clock.cpp - library simple clock display
12 hour format
call on integers hours minutes & seconds use
*/
#include <wprogram.h>
#include <clock.h>
clock::clock(unsigned int hours)
{
_hours=hours;
}
clock::clock(unsigned int minutes)
{
_minutes=minutes;
}
clock::clock(unsigned int seconds)
_seconds=seconds;
}
void clock::clockfunction()
{
_seconds=++_seconds;
if(_seconds==60)
{ _seconds=0;}
if(_seconds==0)
{_minutes=++_minutes;}
if(_minutes==60)
{_minutes=0;
_hours=++_hours;}
if(_hours==13)
{_hours=01;}
delay (1000);
}
and here header file.
#ifndef clock
#define clock
#include <wprogram.h>
class clock
{
public:
clock (unsigned int hours);
clock (unsigned int minutes);
clock (unsigned int seconds);
void clockfunction;
private:
unsigned int _hours;
unsigned int _minutes;
unsigned int _seconds;
};
#endif
can enlighten me going wrong here? won't compile when try make example file library
any appreciated

Arduino Forum > Forum 2005-2010 (read only) > Software > Development > Creating Libraries HELP!!!
arduino
Comments
Post a Comment