Hey guys.
I wonder if you can help me.
My question is whether I can compare the name of a servant. That is, I in the method get a servant and I would like to make an "if" function with the name of that servant. In other words, if the servant's name was X I would do Y.
void read_serial_byte_set_servo(Servo& servo, bool invert, int n) {
// I want this function
if(Servo.name=="TemperaturaAgua")
{
}
}
The answer to your question is no, you cannot refer to a servo by name like that
The fact that you want to use a name seems to indicate that you have more than one servo. If that is the case then you can create an array of servos and refer to them by number. If you give the servo numbers variable names you could do something like this (untested)
It seems like a slightly odd thing to want to do. The code calling the function knows which servo it is passing, so if you want the behavior to vary, you can make the decision there and call an appropriate function without having to check again in that function which servo was passed.