Page 200 - Programming the Photon Getting Started With the Internet of Things
P. 200

Represents any servo object.




        Example

        Servo myServo;

        void setup () {
                   myservo.attach(D0);
        }




        servo.write


        This sets the exact position of a servo motor.




        Syntax

                   myServo.write(angle);




        Parameters

        angle

        The angle to set the servo to—usually 0 to 180 or −180 to 180.


        myServo

             This represents any servo object connected.



        Example


        Servo myServo;

        void setup() {
                   myServo.attach(100);
        }
   195   196   197   198   199   200   201   202   203   204   205