Custom library question
i know more of c++ question, have difficulties writing library.
how construct in library?
here trying do.
rather rewriting encoder.h brilliant library want add options of own , make superclass (not sure you'd call it). can't seem construct myenc
interface.h
interface.cpp
one more little question (or hope) there way define size of array in constructor :
interface myinterface=interface(5);
where array of int of size 5 created i've searched web couple of hours , can't seem find answer. see people define constant , use define size of array… maybe way, lovely if wasn't.
thank much!
how construct in library?
here trying do.
rather rewriting encoder.h brilliant library want add options of own , make superclass (not sure you'd call it). can't seem construct myenc
interface.h
code: [select]
#ifndef interface_h
#define interface_h
#include "arduino.h"
#include <libraries/encoder.h>
class interface
{
public:
interface();
void begin();
private:
encoder myenc;
};
#endif
interface.cpp
code: [select]
#include "arduino.h"
#include "interface.h"
#include <encoder.h>
interface::interface ()
{
}
void interface::begin()
{
encoder myenc(2, 3);
}
one more little question (or hope) there way define size of array in constructor :
interface myinterface=interface(5);
where array of int of size 5 created i've searched web couple of hours , can't seem find answer. see people define constant , use define size of array… maybe way, lovely if wasn't.
thank much!
Arduino Forum > Using Arduino > Programming Questions > Custom library question
arduino
Comments
Post a Comment