I wanna know how to read bluetooth sensor

#include <SoftwareSerial.h>

int blueTx=2;
int blueRx=3;
SoftwareSerial mySerial(blueTx,blueRx);

const int ledpin=8;
const int ledpin1=9;
const int ledpin2=10;
const int sensorpin=A0;

void setup()
{
Serial.begin(9600);
MySerial.begin(9600);
pinMode(ledpin, OUTPUT);
pinMode(ledpin1, OUTPUT);
pinMode(ledpin2, OUTPUT);
}
/*red가 8, yellow가 9, green이 10 이거 알고 코드짜기*/
void loop()
{
 int rate = analogRead(sensorpin);
 Serial.println(rate);

  if(rate<100)
  {
  digitalWrite(ledpin, HIGH);
  digitalWrite(ledpin1, LOW);
  digitalWrite(ledpin2, LOW);
  }
  else if(rate<300)
  {
  digitalWrite(ledpin, LOW);
  digitalWrite(ledpin1, HIGH);
  digitalWrite(ledpin2, LOW);
  }
  else if(rate<500)
  {
  digitalWrite(ledpin, LOW);
  digitalWrite(ledpin1, LOW);
  digitalWrite(ledpin2, HIGH);
  }
  else
  {
  digitalWrite(ledpin, HIGH);
  delay(100);
  digitalWrite(ledpin, LOW);
  delay(100);
 digitalWrite(ledpin1, HIGH);
 delay(100);
 digitalWrite(ledpin1, LOW);
 delay(100);
 digitalWrite(ledpin2, HIGH);
 delay(100);
 digitalWrite(ledpin2, LOW);
 delay(100); 
  }
 if(mySerial.available()){
  Serial.write(mySerial.read());
  }
 if(Serial.available()){
 mySerial.write(Serial.read());
 }
 }
 }

I wrote the code to just change the led light. But now i wanna get resistance result in a phone so I added HC-06 code to get the result. But I can't see anything when I connected HC-06 module. How can I see the result in my phone??

Welcome to the forum

SoftwareSerial mySerial(blueTx,blueRx);

The first parameter should be the Rx pin and the second the Tx pin. How is the HC06 wired to the Arduino ?

Post a schematic showing all connections, not a frizzy picture. Links to technical information on all hardware devices would also help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.