HMC6352の動作確認用プログラムです。

Dependencies:   mbed HMC6352

Committer:
ushiroji
Date:
Sun Oct 24 11:33:44 2021 +0000
Revision:
0:27da40c99bee
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ushiroji 0:27da40c99bee 1 #include "mbed.h"
ushiroji 0:27da40c99bee 2 #include "HMC6352.h"
ushiroji 0:27da40c99bee 3
ushiroji 0:27da40c99bee 4 HMC6352 compass(D4, D5);
ushiroji 0:27da40c99bee 5 Serial pc(USBTX, USBRX);
ushiroji 0:27da40c99bee 6
ushiroji 0:27da40c99bee 7 int main()
ushiroji 0:27da40c99bee 8 {
ushiroji 0:27da40c99bee 9 compass.setOpMode(HMC6352_CONTINUOUS, 1, 20);
ushiroji 0:27da40c99bee 10
ushiroji 0:27da40c99bee 11 pc.printf("\r\n\DIGITAL COMPASSS START\r\n");
ushiroji 0:27da40c99bee 12 while(1)
ushiroji 0:27da40c99bee 13 {
ushiroji 0:27da40c99bee 14 wait(1);
ushiroji 0:27da40c99bee 15 pc.printf("Heading is: %f\n", compass.sample() / 10);
ushiroji 0:27da40c99bee 16 }
ushiroji 0:27da40c99bee 17 }