Hello, I am a beginner in arduino, I am at a crossroads, the situation is as follows, I am automating the access to a door with the Sinric.pro library and the esp8266 board, I am modifying the example code that is in the library, the case is that this function must send a true for 5 seconds without stopping the program and then send a false, I don't know much about the arduino syntax, thank you in advance.
hello, sorry for my bad explanation, I can't modify that true since it goes with the basic flow of the program, the main idea is to change the state, when sending the unlock command the state takes unlocked it returns a true for 5 seconds later returns to locked, for this I am trying to capture the commands that I send from the Sinric page but it is getting quite complicated and the code does not help me much.
/**
* @brief Callback definition for onLockState function
*
* Gets called when device receive a `setLockState` request \n
* @param[in] deviceId String which contains the ID of device
* @param[in] state `true` = device is requested to lock \n `false` = device is requested to unlock
* @param[out] state `true` = device has been locked \n `false` = device has been unlocked
* @return the success of the request
* @retval true request handled properly
* @retval false request was not handled properly because of some error
*
* @section LockStateCallback Example-Code
* @code
* bool onLockState(const String &deviceId, bool &lockState) {
* Serial.printf("Device is %s\r\n", lockState?"locked":"unlocked");
* return true;
* }
* @endcode
**/
after all lockState must be modified by function and passed back as result via reference. the other bool is just to inform caller on success of the operation
I’m sorry I don’t have hardware so my help is very limited. You can try examples, there are plenty that come with the library and see if you can find something that almost does what you want