Motor Control Robots with Voltage Regulator - What is digitalWrite() in arduino ?



What is digitalWrite() in arduino ?

    • The main objective of digitalwrite function in arduino is to write a HIGH or a LOW value to the defined port on the robot. the ports are exposed on the robot as Tinker Kit connectors.
    • It does not return any value while connecting in arduino.
    • The importing point to be noticed is that analog input pins can be used as digital pins, referred to as A0, A1, etc.
    • Additionally the capitalization of the W in digitalWrite and HIGH/LOW is mandatory
    • In Arduino Uno/Nano microcontroller, - HIGH is equivalent to 5V, while - LOW is equivalent to 0V.
     Digital write in arduino

    Digital write in arduino

      Syntax

        digitalWrite(pin, value); 
        

        Example:

          digitalWrite(2, HIGH); or digitalWrite(13, LOW)
          

          delay();

            • The delay function pauses the program for the amount of time (in milliseconds).
            • The important to be noticed in delay() is that is not in seconds it was in milliseconds

            Syntax

               delay(ms); 
              

              Example:

                delay(1000); or delay(50);
                

                Code

                  void setup()
                  {
                   pinMode(3, OUTPUT); 
                  } 
                  void loop()
                  { 
                  digitalWrite(3, HIGH);
                   delay(500); 
                  digitalWrite(3, LOW); 
                  delay(500);
                   }
                  

                  Related Searches to Motor Control Robots with Voltage Regulator - What is digitalWrite() in arduino ?