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.
solenoid.cpp
- Committer:
- uru
- Date:
- 2017-09-27
- Revision:
- 1:a04fadd675dc
- Parent:
- 0:31ce4ad8c8f6
File content as of revision 1:a04fadd675dc:
#include "solenoid.h"
void solenoid::output()
{
i2c->write(adr<<1,&PORT,1);
}
solenoid::solenoid(I2C *I2c,char adr_):i2c(I2c)
{
adr=adr_;
}
solenoid& solenoid::operator=(char po)
{
PORT=po;
output();
return *this;
}
void solenoid::Port(char port,char po)
{
port= 0b100000000 >> port;
if(po==0) {
port ^= 0xFF;
PORT = PORT & port;
} else
PORT = PORT | port;
output();
}