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.
Diff: BAROMETER.cpp
- Revision:
- 1:7badb569b734
- Child:
- 2:8689bf235745
diff -r 0f1293836634 -r 7badb569b734 BAROMETER.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BAROMETER.cpp Mon Jun 29 01:39:07 2020 +0000 @@ -0,0 +1,27 @@ +#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); +}