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

Syntax

                   digitalWrite(pin, value);




        Parameters

        pin

             The digital pin number.


        value

             The value is either HIGH or LOW.



        Return Value


        None



        Example


                   digitalWrite(D0, HIGH);


        This turns on digital pin 0 and outputs 3V3.



        if


        This very useful function executes a certain block of code if the conditions are true.




        Syntax


                   if(condition) {
                              //executable code goes here

                   }



        Example


        int = 1;
        if (n < 1) {

                   digitalWrite(Ledred, HIGH);
        }
        if (n > 1) {
                   digitalWrite(Ledgreen, HIGH);

        }
   192   193   194   195   196   197   198   199   200   201   202