Simple sample of AK8963C
Dependencies: AK8963 SerialNano mbed
Revision 1:e04edd0ca606, committed 2017-03-03
- Comitter:
- coisme
- Date:
- Fri Mar 03 02:30:55 2017 +0000
- Parent:
- 0:cde32ab84750
- Commit message:
- Add \r to the message.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r cde32ab84750 -r e04edd0ca606 main.cpp --- a/main.cpp Thu Mar 02 09:58:06 2017 +0000 +++ b/main.cpp Fri Mar 03 02:30:55 2017 +0000 @@ -31,6 +31,7 @@ if(ak8963.setOperationMode(AK8963::MODE_CONTINUOUS_1) != AK8963::SUCCESS) { // Failed to set the device into continuous measurement mode. serial.printf("Failed to set device mode.\n"); + return -1; } AK8963::Status statusAK8963 = AK8963::NOT_DATA_READY; @@ -42,7 +43,7 @@ if (statusAK8963 == AK8963::DATA_READY) { AK8963::MagneticVector mag; ak8963.getMagneticVector(&mag); - serial.printf("%d,%5.1f,%5.1f,%5.1f\n", + serial.printf("%d,%5.1f,%5.1f,%5.1f\r\n", mag.isOverflow, mag.mx, mag.my, mag.mz); statusAK8963 = AK8963::NOT_DATA_READY;