hello everyone.
i have a small problem i need to make an led light up when the bluetooth connection is successful. iam calling the app_data() function from the void loop and when i connect to Bluetooth data is automatically displayed on the app but if just tried to light up the LED directly from the app_data() function it will always be on. how can i solve this issue.
i tried using .avalible function but its not working for me.
Void app_data()
{
if(Bluetooth.available()){
analogWrite(7,125);
}
else
{
analogWrite(7,0);
}
Bluetooth.print(G_Tilt);// tilt angle
Bluetooth.print(",");
Bluetooth.print(G_OA);// optimal angle
Bluetooth.print(",");
Bluetooth.print(G_LAT);// latitude
Bluetooth.print(",");
Bluetooth.print(G_PVtemp); //PV Temp
Bluetooth.print(",");
Bluetooth.print(G_VOLT);// volts
Bluetooth.print(",");
Bluetooth.print(G_AMP); //amps
Bluetooth.print(",");
Bluetooth.print(G_Power); // power
Bluetooth.print(",");
Bluetooth.print(G_drybulb); //dry bulb temp
Bluetooth.print(",");
Bluetooth.print(G_wetbulb); // wet bubl temp
Bluetooth.print(",");
Bluetooth.print(G_RH*100); // reltive humidity
Bluetooth.print(",");
Bluetooth.print(G_pres/1000); //atm pressure
Bluetooth.print(",");
Bluetooth.print(G_pws/1000); // sat pressure
Bluetooth.print(",");
Bluetooth.print(G_PW/1000); //partial pressure
Bluetooth.print(",");
Bluetooth.print(G_W,5); // humidty ratio
Bluetooth.print(",");
Bluetooth.print(G_v); // specific voulme
Bluetooth.print(",");
Bluetooth.print(G_den); //Air density
Bluetooth.print(",");
Bluetooth.print(G_Tdew); //dew temp
Bluetooth.print(",");
Bluetooth.print(G_LAT); // latitude
Bluetooth.print(",");
Bluetooth.print(G_LONG); //lognitude
Bluetooth.print(",");
Bluetooth.print(G_alt);// altitude
Bluetooth.println(",");
//Bluetooth.print("23");
// Bluetooth.print(",");
// Bluetooth.println(millis() / 1000);
delay(10);
}