New project

Dependencies:   mbed TextLCD

Switch.cpp

Committer:
jasminealice
Date:
2018-06-13
Revision:
23:bb57966cb776
Parent:
21:31647d80614f
Child:
25:90f7a34c253a

File content as of revision 23:bb57966cb776:

#include "Switch.h"

Switch::Switch(const unsigned int newaddress, const unsigned int newinst)
{
    //ctor
    address = newaddress;
    inst = newinst;
    nrPacket = 10;
    if(inst == 0x82)
        nrPacket = 100;
    if(inst == 0x84)// || inst == 0x81)
        switchOn();
    else
        switchOff(); 
    
}

Switch::~Switch()
{
    //dtor
}

void Switch::switchOn(){
    DCC_send_command(address, inst, nrPacket); 
}

void Switch::switchOff() {
    DCC_send_command(address, inst, nrPacket);
    unsigned int off = 0x80;
    DCC_send_command(address, off, nrPacket);
}