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:
- 1:7badb569b734
- Child:
- 2:8689bf235745
File content as of revision 1:7badb569b734:
#include "mbed.h" #include "BAROMETER.h" BAROMETER::BAROMETER( PinName sda, PinName scl, adress ) : i2c(sda, scl), _addr(adress) { } BAROMETR::~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) { cmd[0]=regist; cmd[1]=data; i2c.write(addr,cmd,2); }