forked from Integreight/1Sheeld-Arduino-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuzzerShield.cpp
52 lines (39 loc) · 796 Bytes
/
BuzzerShield.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
Project: 1Sheeld Library
File: BuzzerShield.cpp
Version: 1.0
Compiler: Arduino avr-gcc 4.3.2
Author: Integreight
Date: 2014.5
*/
#define FROM_ONESHEELD_LIBRARY
#include "OneSheeld.h"
#include "BuzzerShield.h"
//Class Constructor
BuzzerShieldClass::BuzzerShieldClass():ShieldParent(BUZZER_ID)
{
buzzing = false;
}
//Buzzing On
void BuzzerShieldClass::buzzOn()
{
if(buzzing == false)
{
setValue(BUZZER_ON);
buzzing=true;
}
}
//Buzzing Off
void BuzzerShieldClass::buzzOff()
{
if(buzzing == true)
{
setValue(BUZZER_OFF);
buzzing=false;
}
}
//Buzz Setter
void BuzzerShieldClass::setValue(byte x)
{
OneSheeld.sendShieldFrame(BUZZER_ID,0,BUZZER_SET,1,new FunctionArg(1,&x));
}