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.
Fork of Nucleo_printf1 by
Revision 1:d4d2ab411f7e, committed 2017-11-06
- Comitter:
- e58136782000
- Date:
- Mon Nov 06 06:50:52 2017 +0000
- Parent:
- 0:9522c4dc43b8
- Commit message:
- Dissolved oxygen sensor offline finish
Changed in this revision
BME280/BME280.hpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9522c4dc43b8 -r d4d2ab411f7e BME280/BME280.hpp --- a/BME280/BME280.hpp Fri Nov 03 09:16:32 2017 +0000 +++ b/BME280/BME280.hpp Mon Nov 06 06:50:52 2017 +0000 @@ -1,5 +1,4 @@ #include "mbed.h" - #ifndef BME280_HPP #define BME280_HPP @@ -15,7 +14,7 @@ int datareadfuiction(int data); void receive(); private: - int buf[BME280_size]; + char buf[BME280_size]; void send_AT(); int data; @@ -57,21 +56,19 @@ } void BME280::receive() { - pc.printf("start receive\n"); - pc.printf("buf 0 %d\n",buf[0]); - for(int i=0;i<BME280_size;i++){ - buf[i] = sensor.getc(); - pc.printf("data %d\n",i); - //pc.putc(buf[i]); + pc.printf("start receive \n"); + for(int i=0;i<BME280_size;i++) + { + sensor.gets(buf,7); } } int BME280::data_read() -{\ +{ receive(); //wait(0.2); -// judgement_data(this->buf); + judgement_data(this->buf); return data; }
diff -r 9522c4dc43b8 -r d4d2ab411f7e main.cpp --- a/main.cpp Fri Nov 03 09:16:32 2017 +0000 +++ b/main.cpp Mon Nov 06 06:50:52 2017 +0000 @@ -11,13 +11,14 @@ int main() { - int data; + sensor.format(8,Serial::None,1); while(1) { - serial.printf("test 1\n"); BME280.receive(); - serial.printf("test 2\n"); - data= BME280.datareadfuiction(0); - serial.printf("first data : %d\n",data); + serial.printf("data 1 : %d\n",BME280.datareadfuiction(0)); + serial.printf("data 2 : %d\n",BME280.datareadfuiction(1)); + serial.printf("data 3 : %d\n",BME280.datareadfuiction(2)); + serial.printf("data 4 : %d\n",BME280.datareadfuiction(3)); + serial.printf("data 5 : %d\n",BME280.datareadfuiction(4)); } }