Différences entre versions de « Projets:Testi »

De wikiup
Sauter à la navigation Sauter à la recherche
Ligne 16 : Ligne 16 :
 
==Code==
 
==Code==
 
<pre>
 
<pre>
static void notifyCallback(
+
bool connectToServer() {
  BLERemoteCharacteristic* pBLERemoteCharacteristic,
+
   Serial.print("Forming a connection to ");
  uint8_t* pData,
+
   Serial.println(myDevice->getAddress().toString().c_str());
  size_t length,
 
  bool isNotify) {
 
    
 
  w = pData[0];//w = perifit[0];
 
   x = pData[1];
 
  y = pData[2];
 
  z = pData[3];
 
  ps = x + (256 * w);
 
  pp = z + (256 * y);
 
  myvalue = map(ps, 180, 2700, 10500, 1500);//If the lamp lights on when should not, put a lower value for 10500. Si l'ampoule s'allume au repos par erreur baisser un peu la valeur de 10500 dans le mapping
 
  
}
+
  BLEClient*  pClient  = BLEDevice::createClient();
 +
  Serial.println(" - Created client");
  
class MyClientCallback : public BLEClientCallbacks {
+
  pClient->setClientCallbacks(new MyClientCallback());
    void onConnect(BLEClient* pclient) {
+
 
    }
+
  // Connect to the remove BLE Server.
 +
  pClient->connect(myDevice);  // if you pass BLEAdvertisedDevice instead of address, it will be recognized type of peer device address (public or private)
 +
  Serial.println(" - Connected to server");
  
    void onDisconnect(BLEClient* pclient) {
 
      connected = false;
 
      Serial.println("onDisconnect");
 
    }
 
};
 
 
</pre>
 
</pre>
  

Version du 1 juin 2021 à 17:49

Description du projet

Une fois sur deux

Cahier des charges

Analyse de l'existant

Equipe (Porteur de projet et contributeurs)

  • Porteurs du projet :
  • Concepteurs/contributeurs :
  • Animateur (coordinateur du projet)
  • Fabmanager référent
  • Responsable de documentation

Code

bool connectToServer() {
  Serial.print("Forming a connection to ");
  Serial.println(myDevice->getAddress().toString().c_str());

  BLEClient*  pClient  = BLEDevice::createClient();
  Serial.println(" - Created client");

  pClient->setClientCallbacks(new MyClientCallback());

  // Connect to the remove BLE Server.
  pClient->connect(myDevice);  // if you pass BLEAdvertisedDevice instead of address, it will be recognized type of peer device address (public or private)
  Serial.println(" - Connected to server");

Matériel nécessaire

Outils nécessaires

Coût

Délai estimé

Fichiers source

Etapes de fabrication pas à pas

Durée de fabrication du prototype final

Journal de bord