Recently I have started to work on a project. So I connected to the arduino DHT 11 and OLED(128x32) and I tried to show the data on the screen and it worked. When I connected the hc-06 and tried to send the data from dht11 to my phone it didn't work and even stopped showing the data on the screen
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
#include "DHT.h"
#define dhtPin 7
#define dhtType DHT11
DHT dht(dhtPin, dhtType);
Adafruit_SSD1306 display(OLED_RESET);
#include<SoftwareSerial.h>
SoftwareSerial bt(10, 11);
#include <SPI.h>
void setup() {
Serial.begin(9600);
Wire.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3c);
dht.begin();
bt.begin(9600);
Serial.println("Ready..");
}
void loop() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(0,10);
display.print("Temprature: ");
display.print(temp);
display.display();
if(bt.available() >0){
inchar=bt.read();
Serial.println(inchar);
delay(20);
if (inchar=='v'){
delay(10);
Serial.println(inchar);
delay(2000);
Serial.print("Temperature:");
Serial.print(temp);
Serial.print("C");
}
}