Hi Md,
As per my understanding, you are using "writePosition()" in order to track a red object using a servo motor, but encountering an error.
I would like to draw your attention to the fact that the second parameter in the "writePosition()" is the position of servo motor shaft specified as a number representing the angle from 0 to 1, where 0 represents the minimum angle of rotation and 1 represents the maximum angle of rotation of the servo motor. In your code, it looks like this parameter "deg_map" is out of this specified range.
Try to find out the range of "deg". Let's say it is between "deg_min" and "deg_max", then its mapping would be:
deg_map = (deg - deg_min) / (deg_max - deg_min);
This should help bring the "deg_map" parameter within the specified range of 0 and 1.
To know more about “writePosition()”, kindly refer to the following link: https://www.mathworks.com/help/supportpkg/arduinoio/ref/writeposition.html