Guys, i need ur help , im working on rotary smart parking application and i want to receive some data (parking statust (6slots) and reservation code from arduino. I did the arduino code,
this is a part of it (communication with bluetooth):
void sendParkingStatus() {
for(int i=0; i<6; i++) {
// Replace BTSerial.write(places[i][1]); with
BTSerial.print(places[i][1]);
if (i < 5) {
BTSerial.print(","); // separate with a comma
}
}
BTSerial.println(); // send a newline character at the end
}
void loop()
....................................
.....................................
{
if (BTSerial.available())
{
Serial.write(BTSerial.read());
}
// Keep reading from Arduino Serial Monitor and send to HC-06
if (Serial.available())
{
BTSerial.write(Serial.read());
}
if (BTSerial.available())
{
char c = BTSerial.read(); // Lire le caractère depuis le Bluetooth
// Si l'application Android demande le statut des parkings
if (c == 'S')
{
sendParkingStatus();
}
// Si l'application Android veut faire une réservation
else if (c == 'R')
{
// Ici, nous supposons que l'application Android envoie 'R' suivi d'une séquence de 6 caractères
// qui représente l'identifiant pour la réservation. Ce code doit correspondre à celui généré
// par la fonction get_new_id().
String id = "";
for (int i = 0; i < 6; i++) {
while (!BTSerial.available()) {}
id += (char)BTSerial.read()
}
store_id(id);
}
}
}
delay(100);
}