Help with sensor reading sent to app via Bluetooth

Hi,

I want to send FSR sensor readings to an app and do it with the help from a Bluetooth module (HC-05). I have the following code for the FSR reading (including an LED that turns on/off):

int fsrPin = 0;
int LEDpin = 11;
int fsrReading;
int LEDbrightness;

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

void loop(void) {
fsrReading = analogRead(0);

Serial.print("Analog reading = ");
Serial.print(fsrReading);

if (fsrReading < 10) {
Serial.println(" - No pressure");
} else if (fsrReading < 200) {
Serial.println(" - Light");
} else if (fsrReading < 500) {
Serial.println(" - Light");
} else if (fsrReading < 800) {
Serial.println(" - Medium");
} else {
Serial.println(" - High");
}

LEDbrightness = map(fsrReading, 0, 1023, 0, 255);
// LED gets brighter the harder you press
analogWrite(LEDpin, LEDbrightness);

delay(1000);
}

and as mentioned, I want to use the HC-05. I connect its RX-->TX and its TX--> RX, then connect it to the 5 V (dividing it with a resistor) and one to ground. I found the following code for the module

Now, here is the question. Where in my own code should I include his code? I have tried different ways and get an error. :confused: Maybe you can suggest a code? Any help is appreciated!

Thanks!

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