Advertisement
Double_G

BT+WiFi

Nov 24th, 2020 (edited)
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <WiFi.h>        
  2. #include "BluetoothSerial.h"
  3.  
  4. BluetoothSerial SerialBT;
  5.  
  6. const char* ssid     = "wifissd";               // wifi SSD
  7. const char* password = "password";        // wifi password
  8.  
  9. void setup () {
  10.   SerialBT.begin("Clock");
  11.   WiFi.begin(ssid, password);  
  12.  
  13. while (WiFi.status() != WL_CONNECTED) {
  14.     delay(500);
  15.     Serial.print('.');
  16.     }
  17. }
  18.  
  19. void loop () {
  20.  
  21. if (SerialBT.available())
  22.   {
  23.     char received = SerialBT.read();
  24.     btBuffer += received;
  25.  
  26.     if (received == '|')
  27.     {
  28.         processCommand();
  29.         btBuffer = "";
  30.     }
  31.   }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement