Help converting const char to float in Mesh.subscribe()

The Mesh.subscribe() and Mesh.publish() functions send and receive data as const char. Any tips on converting that to float, int, etc. for calculation?

Example syntax:

void myHandler(const char *event, const char *data)
  Serial.printlnf("event=%s data=%s", event, data ? data : "NULL");
//would like to cast / convert to float to do maths...tried float variable = data.toFloat() but got compiler errors.

void setup()
  Mesh.subscribe("motion-sensor", myHandler);
double value = atof(data);

You can’t call toFloat() because data is a const char * not a String object. The standard c library function atof can be used with const char *.


Thank you very much! Been a while since I used that c std lib function! I did try to convert to a string first but wasn’t getting very far with that either.