Skip to content

Instantly share code, notes, and snippets.

@mgulsoy
Created November 29, 2019 09:38
Show Gist options
  • Save mgulsoy/b266b2223f0e8d27d6a4e5c2cf239516 to your computer and use it in GitHub Desktop.
Save mgulsoy/b266b2223f0e8d27d6a4e5c2cf239516 to your computer and use it in GitHub Desktop.
Gatt Server Loop Fonksiyonu
void loop(){
...
...
int pil_seviyesi_adc = analogRead(pil_olcum_pini);
uint8_t pil_seviyesi = map (pil_seviyesi_adc, 0, 4096, 0, 100);
pBatteryLevelCharx->setValue(&pil_seviyesi, 1); //sadece READ işlemi yapılacak
if( digitalRead(sensor_pin) == HIGH ) {
pSensorValueCharx->setValue("Acik");
} else {
pSensorValueCharx->setValue("Kapali");
}
if (ble2902.getNotifications() == true) {
pSensorValueCharx->notify(); //Bildir!
}
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment