-
Notifications
You must be signed in to change notification settings - Fork 67
Request explaination #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The question mark in the code is known as the ternary operator in C. Ternary is an adjective meaning three parts. Its a mathematical term (computer science is a branch of mathematics). It is available in many languages: https://en.wikipedia.org/wiki/%3F: Also in the code sample you posted " Before explaining the code you asked about you should first understand the ternary operator: This is the typical textbook example..
Ok so now we know what the ternary operator One last point - For the avoidance of doubt: In C true is represented by any numeric value not equal to 0 and false is represented by 0. Ok, now that's covered! We can answer your question! The code you asked about Reading the code initially one might think the value of The code you provided did not have the assignment but I assumed you got the code from here nkolban/esp32-snippets#269 |
How do you request that you compile it? In file included from C:\Users\eric8\Documents\Arduino\BLE_Proximity_Sensor\BLE_Proximity_Sensor.ino:23:0: D:\homeassistant\arduino-1.8.5\arduino-1.8.5\portable\sketchbook\libraries\ESP32_BLE_Arduino-7951347ed68313d75c367e1f2cce763cb56d1eb2\src/BLEDevice.h:10:23: fatal error: sdkconfig.h: No such file or directory #include "sdkconfig.h" ^ Compilation terminated. Exit status 1 |
Hi,
Could you explain function or meaning of below coding.
// If we are connected to a peer BLE Server, update the characteristic each time we are reached
// with the current time since boot.
if (connected) {
if (onoff) {
Serial.println("Notifications turned on");
pRemoteCharacteristic->getDescriptor(BLEUUID((uint16_t)0x2902))->writeValue((uint8_t*)notificationOn, 2, true);
}
else {
Serial.println("Notifications turned off");
pRemoteCharacteristic->getDescriptor(BLEUUID((uint16_t)0x2902))->writeValue((uint8_t*)notificationOff, 2, true);
}
}
`
The text was updated successfully, but these errors were encountered: