forked from AlbanT/VellemanK8056library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathK8056Velleman.h
41 lines (32 loc) · 1.88 KB
/
K8056Velleman.h
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
/* K8056Velleman.h
Programmer : A.S. Tilanus (alban.tilanus[at]gmail.com)
Company : reptile-addict.nl
Version : 20130421 First release
20130422 Made some changes as discussed in: http://arduino.cc/forum/index.php/topic,161877.msg1211201.html#msg1211201
Description : Arduino library to control the Velleman K8056 8-channel relay card thru RS232
http://www.reptile-addict.nl/arduino/?page_id=209
Keywords : Arduino; RS232; Velleman; K8056;
Copyright : http://opensource.org/licenses/mit-license.php
Disclaimer : THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef K8056Velleman_h
#define K8056Velleman_h
#include "Arduino.h"
class K8056Velleman
{
public:
K8056Velleman();
void begin();
void begin(byte SerialAddress);
void ON(byte CardAddress, byte Relay);
void OFF(byte CardAddress, byte Relay);
void EmergencyStop();
void Toggle(byte CardAddress, byte Relay);
void digitalWrite(byte CardAddress, byte Relay, byte Status);
void byteWrite(byte CardAddress, byte Relay);
private:
byte CheckSum(byte Address, byte Instruction, byte Relay);
void RS232Instruction(byte Address, byte Instruction, byte Relay, byte isBinary);
byte SerialID;
};
#endif