Testé pour projet BTS SN
Fork of HMC6352_HelloWorld by
Mise en oeuvre du capteur de cap HMC6352 sur Nucleo F411RE Attention , utiliser l'alimentation 3.3v sur connecteur Arduino, liaison I2C sur PB_9, PB_8
Diff: main.cpp
- Revision:
- 2:4ddfbf5b65b2
- Parent:
- 0:f9a9be860001
- Child:
- 3:caca5cdad681
- Child:
- 5:cea735befb3c
--- a/main.cpp Sat Nov 27 12:15:56 2010 +0000 +++ b/main.cpp Sat Apr 30 17:06:22 2016 +0000 @@ -1,20 +1,23 @@ #include "HMC6352.h" -HMC6352 compass(p9, p10); +HMC6352 compass(PB_9, PB_8); Serial pc(USBTX, USBRX); +DigitalOut led(LED1); int main() { - pc.printf("Starting HMC6352 test...\n"); + pc.printf("Starting HMC6352 test...\n\r"); //Continuous mode, periodic set/reset, 20Hz measurement rate. compass.setOpMode(HMC6352_CONTINUOUS, 1, 20); while (1) { - + led=0; + wait(0.1); + led=1; wait(0.1); - pc.printf("Heading is: %f\n", compass.sample() / 10.0); + pc.printf("Heading is: %f\n\r", compass.sample() / 10.0); }