Notifications
Clear all

ESP32 Heltec_WIFI-Kit-32 and MPU_6050

1 Posts
1 Users
0 Likes
1,314 Views
DANSCO29
(@dansco29)
New Member
Joined: 2 years ago
Posts: 1
Topic starter  

Hi Folks,

I have an Heltec_WIFI-Kit-32 with OLED,

it works well with an DHT11 and the OLED shows data.

When I connect a MPU-6050 the OLED no longer works normally.

With the code I posted below I can display millis on the OLED,

but not the temp I read from the MCU-6050.

Looks like a problem with SCL and SDA.

Please help!

 

 

#include "Arduino.h"
#include "heltec.h"

#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;

void setup() {
Serial.begin(115000);
Serial.println("Initialize MPU6050");
while (!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
Serial.println("found a valid MPU6050 sensor");
delay(500);
Heltec.begin(true /*DisplayEnable Enable*/, false /*LoRa Disable*/, true /*Serial Enable*/);
}

void loop() {
//float temp = mpu.readTemperature();

Heltec.display->clear();
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
Heltec.display->setFont(ArialMT_Plain_24);
Heltec.display->drawString(0, 0, String(millis()));
//Heltec.display->drawString(20, 0, String(temp));
Heltec.display->display();
delay(10);
}

   
Quote