SHARE
TWEET

Untitled

a guest Apr 25th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "mbed.h"
  2. #include "MMC5883L.h"
  3.  
  4. Serial device(PA_2, PA_3); // tx, rx
  5. MMC5883L comp(PF_0, PF_1);
  6.  
  7. int main() {
  8. device.baud(115200); // nastavení „baudrate“ - přenosové rychlosti 115200 Baud
  9. wait(0.1f);
  10. comp.init();
  11. wait(0.1f);
  12. int16_t data[3] = {0,0,0};
  13.  
  14.     while(1){
  15.         double heading = comp.getHeadingXY(data);
  16.         double Btot = sqrt(pow((double)data[0],2) + pow((double)data[1],2) + pow((double)data[2],2));
  17.         wait(0.02);
  18.         device.printf("\rTOTAL %04f, X %04d, Y %04d, Z %04d \r", Btot, data[0], data[1], data[2]);
  19.         wait(0.02);
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top