-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBluetooth.ino
50 lines (47 loc) · 1.29 KB
/
Bluetooth.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//------------------- Função para desconexão do Bluetooh-----------------------//
void Connect(void *pvParameters) {
for (;;) {
if (connected == false) {
conectaBT();
}
vTaskDelay(50);
}
}
void callback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
{
if (event == ESP_SPP_CLOSE_EVT)
{
Beep(5);
Serial.println("Desconectado");
// tft.fillScreen(BLACK);
//Alert(2, S, "BLUETOOTH" , "RECONECTANDO...", 0);
// ReturnMenu(menu_active);
//delay(1000);
connected = false;
//conectaBT();
}
}
//-----------------------------------------------------------------------------//
//----------- Estabelece Conexão com com VL8 através do bluetooth-------------//
void conectaBT()
{
//Alert(2, S, "AGUARDE" , "Conectando BT...");
Serial.println("Conectando BT...");
connected = SerialBT.connect("VIRTEC_VL8_0102");
if (connected)
{
//delay(100);
//Alert(2, S, "SUCESSO" , "Conectado");
Serial.println("Connected Succesfully!");
//SerialBT.print("PFL,btcon");
//Serial.println("Conectado");
Beep(5);
}
else
{
Serial.println("Falha conexao");
delay(2000);
connected = false;
}
}
//-----------------------------------------------------------------------------//