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.
BAROMETER.cpp
- Committer:
- rary
- Date:
- 2020-06-29
- Revision:
- 3:f7beb1c93ba8
- Parent:
- 2:8689bf235745
File content as of revision 3:f7beb1c93ba8:
#include "mbed.h" #include "BAROMETER.h" BAROMETER::BAROMETER( PinName sda, PinName scl, char adress ) : i2c(sda, scl), _addr(adress) { } BAROMETER::~BAROMETER() { } char BAROMETER::i2c_read(char regist) { char cmd[2]; cmd[0]=regist; i2c.write(_addr,cmd,1); i2c.read(_addr,cmd,1); return cmd[0]; } void BAROMETER::i2c_write(char regist,char data) { char cmd[2]; cmd[0]=regist; cmd[1]=data; i2c.write(_addr,cmd,2); }