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.
Dependencies: mbed HMC5883L_kai_3
main.cpp@3:8b34748c199c, 2020-02-24 (annotated)
- Committer:
- imanomadao
- Date:
- Mon Feb 24 07:47:52 2020 +0000
- Revision:
- 3:8b34748c199c
- Parent:
- 2:2ce6c35efc65
a;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
TUATBM | 0:26409a44f1f3 | 1 | #include "mbed.h" |
TUATBM | 0:26409a44f1f3 | 2 | #include "HMC5883L.h" |
TUATBM | 0:26409a44f1f3 | 3 | |
TUATBM | 0:26409a44f1f3 | 4 | HMC5883L compass(PB_9, PB_8); |
TUATBM | 0:26409a44f1f3 | 5 | |
imanomadao | 3:8b34748c199c | 6 | RawSerial pc(USBTX, USBRX, 9600); |
imanomadao | 3:8b34748c199c | 7 | |
TUATBM | 0:26409a44f1f3 | 8 | int main(){ |
TUATBM | 0:26409a44f1f3 | 9 | int16_t a[3]; |
TUATBM | 0:26409a44f1f3 | 10 | double b; |
TUATBM | 0:26409a44f1f3 | 11 | |
imanomadao | 3:8b34748c199c | 12 | /*while(1){ |
TUATBM | 0:26409a44f1f3 | 13 | compass.init(); |
taknokolat | 2:2ce6c35efc65 | 14 | b= compass.getHeadingXYDeg(-152,286); |
TUATBM | 0:26409a44f1f3 | 15 | printf("%lf\r\n",b); |
imanomadao | 3:8b34748c199c | 16 | wait(1); |
taknokolat | 1:c91577293e84 | 17 | // wait(0.); |
imanomadao | 3:8b34748c199c | 18 | }*/ |
TUATBM | 0:26409a44f1f3 | 19 | |
imanomadao | 3:8b34748c199c | 20 | compass.init(); |
imanomadao | 3:8b34748c199c | 21 | wait_ms(10); |
imanomadao | 3:8b34748c199c | 22 | while(1){ |
imanomadao | 3:8b34748c199c | 23 | compass.getXYZ(a); |
imanomadao | 3:8b34748c199c | 24 | pc.printf("x=%d, y=%d, z=%d,\r\n",a[0],a[2],a[1]); |
imanomadao | 3:8b34748c199c | 25 | b= compass.getHeadingXYDeg(-152,286); |
imanomadao | 3:8b34748c199c | 26 | pc.printf("%lf\r\n",b); |
imanomadao | 3:8b34748c199c | 27 | //printf("%d, %d\r\n",a[0]+20,a[2]+50); |
imanomadao | 3:8b34748c199c | 28 | wait(1); |
imanomadao | 3:8b34748c199c | 29 | } |
taknokolat | 1:c91577293e84 | 30 | |
TUATBM | 0:26409a44f1f3 | 31 | |
imanomadao | 3:8b34748c199c | 32 | //} |
taknokolat | 1:c91577293e84 | 33 | } |