I'm trying to write a library but when I use it get an errors.
This is my HomeAlarm.h
#ifndef HomeAlarm
#define HomeAlarm
// Arduino versioning.
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class HomeAlarm{
public:
HomeAlarm();
void ErrSound();
private:
int _spkPin;
};
#endif
This is HomeAlarm.cpp
#include "HomeAlarm.h";
HomeAlarm::HomeAlarm(){
_spkPin = 13;
}
void HomeAlarm::ErrSound(){
tone(speakerPin, 200);
delay(500);
noTone(speakerPin);
tone(speakerPin, 300);
delay(500);
noTone(speakerPin);
}
This is the calling
#include <HomeAlarm.h>
HomeAlarm alarma();//Buzzer pin
void setup(){
alarma.ErrSound();
}
void loop(){
}
Those are the error that I get
In file included from sketch_jul08a.ino:1:
C:\Program Files (x86)\Arduino\libraries\HomeAlarm/HomeAlarm.h:14: error: expected unqualified-id before ')' token
C:\Program Files (x86)\Arduino\libraries\HomeAlarm/HomeAlarm.h:12: error: an anonymous struct cannot have function members
C:\Program Files (x86)\Arduino\libraries\HomeAlarm/HomeAlarm.h:18: error: abstract declarator '' used as declaration
sketch_jul08a:3: error: expected constructor, destructor, or type conversion before ';' token
sketch_jul08a.ino: In function 'void setup()':
sketch_jul08a:6: error: 'alarma' was not declared in this scope
Thx for help me.