I have problems comparing the variable turnsafe, which is a pointer i guess, with this "A", an integer or anything. At the moment the compiler doesnt say anything but its still not working...
Im receiving turnsafe from another ESP32 over BLE using the notify and client example sketch. This part works, but I need to figure out how to work with my transmitted variable in this if loop...
I have problems comparing the variable turnsafe, which is a pointer i guess, with this "A", an integer or anything. At the moment the compiler doesnt say anything but its still not working...
Im receiving turnsafe from another ESP32 over BLE using the notify and client example sketch. This part works, but I need to figure out how to work with my transmitted variable in this if loop...
Any advice?
Thx in advance!
As the previous poster said use strcmp() if indeed turnsafe is a pointer to char.
FYI: What if((char*)turnsafe=="A") is doing is casting turnsafe to a pointer to char and then comparing it to the pointer to wherever the constant string "A" resides in memory, which is who knows where.
Im sorry, never used strcmp. How do you code this?
In the upper case the compiler says:
invalid conversion from 'uint8_t* {aka unsigned char*}' to 'const char*' [-fpermissive]
or this way
if(strcmp((char*)turnsafe)=="A")
too few arguments to function 'int strcmp(const char*, const char*)'
do you think you can have a look at the sketch I uploaded earlier?
all I need to do is comparing the transmitted variable pData which I equaded with turnsafe...
This way no comparison will be made unless notifyCallback() function has been executed. However, in the notifyCallback() function the pData pointer is assigned to turnsafe. I'm not convinced that pointer remains valid after exiting notifyCallback. You may want to copy the data.