0
votes

I have a problem with getting sensor data from MPU6050 through Bluetooth module HC-06. I am using Arduino Micro Pro. I do not have a lot of experience, so it could be some rookie mistake.

If I upload this code to Arduino, then connect via Bluetooth, I continuously receive "234" (I am using Tera Term):

void setup() {
  Serial1.begin(9600); 
  delay(50);
}

void loop() {

  Serial1.println("234");
  delay(500); 
}

Also when I use this code without unplugging from PC, I correctly receive gyro and accelerometer data on serial monitor in Arduino IDE:

#include <Wire.h>
#include <I2Cdev.h>
#include <MPU6050.h>

MPU6050 mpu;
int16_t ax, ay, az, gx, gy, gz;

void setup() {
   Serial.begin(9600);

   Serial.println("a");


   Wire.begin();

   Serial.println("b");

   mpu.initialize();

   Serial.println("c");
}

void loop() {
  mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);


  Serial.print("hh");
  Serial.println(ax);
  delay(20);
}

So all the hardware is supposedly working correctly. However, when I change all the Serial functions in the last example to Serial1 and then try to get the data through Bluetooth, the Tera Term window just stays blank without any kind of data that I am aware of coming in.

What am I doing wrong?

1
There is no "Arduino Micro Pro". Pro Micro is not Arduino's design. It's from SparkFun.gre_gor

1 Answers

0
votes

serial1 is for serial port of your component.

Do you plug Bluetooth uart on serial port 1?

Do you detect properly The Bluetooth module?