Go Down

Topic: Help with sensor reading sent to app via Bluetooth (Read 906 times) previous topic - next topic



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) {

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

Serial.print("Analog reading = ");

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);


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.  :smiley-confuse:   Maybe you can suggest a code? Any help is appreciated!


Go Up