Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Switch.cpp
- Committer:
- jasminealice
- Date:
- 2018-06-20
- Revision:
- 25:90f7a34c253a
- Parent:
- 23:bb57966cb776
- Child:
- 31:9d973398554f
File content as of revision 25:90f7a34c253a:
#include "Switch.h"
Switch::Switch(const unsigned int newaddress, const unsigned int newinst)
{
//ctor
address = newaddress;
inst = newinst;
nrPacket = 20;
if(inst == 0x82)
nrPacket = 50;
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);
}
