Last active
November 20, 2023 03:02
-
-
Save hlog2e/944771c907fcc5333b7c4ed64495b18a to your computer and use it in GitHub Desktop.
hmc5883 + ble 모듈
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <MechaQMC5883.h> | |
#include <SoftwareSerial.h> | |
int BT_RX = 2; | |
int BT_TX = 3; | |
SoftwareSerial HM10(BT_RX, BT_TX); | |
MechaQMC5883 qmc; | |
void setup() { | |
Wire.begin(); | |
Serial.begin(9600); | |
qmc.init(); | |
HM10.begin(9600); | |
//qmc.setMode(Mode_Continuous,ODR_200Hz,RNG_2G,OSR_256); | |
} | |
void loop() { | |
int x,y,z; | |
qmc.read(&x,&y,&z); | |
HM10.print(x); | |
HM10.print(','); | |
HM10.print(y); | |
HM10.print(','); | |
HM10.println(z); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment