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.
Dependents: TestBenchSerenity-proto_F429ZI TestBenchFlow HSPFLOW1 TestBenchFlow1 ... more
Diff: keller_pressure.cpp
- Revision:
- 5:3ac90d95062a
- Parent:
- 4:c298ec31dd93
- Child:
- 6:deb4008b136e
diff -r c298ec31dd93 -r 3ac90d95062a keller_pressure.cpp --- a/keller_pressure.cpp Mon Jun 05 21:01:56 2017 +0000 +++ b/keller_pressure.cpp Wed Sep 13 18:33:00 2017 +0000 @@ -1,45 +1,45 @@ // Sample code -//#include <mbed.h> -//#include "keller_pressure.h" -// -//DigitalOut myled(LED1); -//Serial pc(SERIAL_TX, SERIAL_RX); -// -//// an I2C sub-class that provides a constructed default -//class I2CPreInit : public I2C -//{ -//public: -// I2CPreInit(PinName sda, PinName scl, int freq) : I2C(sda, scl) { -// frequency(freq); -// }; -//}; -////I2CPreInit gI2C1(I2C_SDA, I2C_SCL, I2C frequency); -//I2CPreInit i2c(PB_9, PB_8, 400000); -//KELLER_PRESSURE pumpP(i2c, 0x40); -// -//int main() -//{ -// pc.baud(250000); -// pc.printf("Starting up...\n\r"); -// if (pumpP.isAvailable()) { -// pc.printf("ACK\r\n"); -// pumpP.readPT(); -// pc.printf("Pmin: %.03f Pmax: %.03f\r\n", pumpP.pmin, pumpP.pmax); -// pc.printf("Year: %d Month: %d Day: %d Mode: %d\r\n", pumpP.year, pumpP.month, pumpP.day, pumpP.mode); -// pc.printf("Status: 0x%x\r\n", pumpP.getStatus()); -// pc.printf("%.02fkPa %.02fpsi %.02fC\r\n", pumpP.pressureKPA, pumpP.pressurePSI, pumpP.temperatureC); -// } -// while (1) { -// // Main loop -// if (pumpP.isAvailable()) { -// pumpP.readPT(); -// pc.printf("%.02fkPa %.02fpsi %.02fC\r\n", pumpP.pressureKPA, pumpP.pressurePSI, pumpP.temperatureC); -// } -// wait(1); -// } -// -//} -// +/* +#include <mbed.h> +#include "keller_pressure.h" + +DigitalOut myled(LED1); +Serial pc(SERIAL_TX, SERIAL_RX); + +// an I2C sub-class that provides a constructed default +class I2CPreInit : public I2C +{ +public: + I2CPreInit(PinName sda, PinName scl, int freq) : I2C(sda, scl) { + frequency(freq); + }; +}; +//I2CPreInit gI2C1(I2C_SDA, I2C_SCL, I2C frequency); +I2CPreInit i2c(PB_9, PB_8, 400000); +KELLER_PRESSURE pumpP(i2c, 0x40); + +int main() +{ + pc.baud(250000); + pc.printf("Starting up...\n\r"); + if (pumpP.isAvailable()) { + pc.printf("ACK\r\n"); + pumpP.readPT(); + pc.printf("Pmin: %.03f Pmax: %.03f\r\n", pumpP.pmin, pumpP.pmax); + pc.printf("Year: %d Month: %d Day: %d Mode: %d\r\n", pumpP.year, pumpP.month, pumpP.day, pumpP.mode); + pc.printf("Status: 0x%x\r\n", pumpP.getStatus()); + pc.printf("%.02fkPa %.02fpsi %.02fC\r\n", pumpP.pressureKPA, pumpP.pressurePSI, pumpP.temperatureC); + } + while (1) { + // Main loop + if (pumpP.isAvailable()) { + pumpP.readPT(); + pc.printf("%.02fkPa %.02fpsi %.02fC\r\n", pumpP.pressureKPA, pumpP.pressurePSI, pumpP.temperatureC); + } + wait(1); + } +} +*/ // End sample code #include "keller_pressure.h"