HOW TO WRITE A DIGITAL OUTPUT. ARDUINO IDE

HOW TO WRITE A DIGITAL OUTPUT. ARDUINO IDE

Before writing a digital output it is needed to set the pin as OUTPUT. See the following post to configure a pin.

Function to configure a pin as INput/OUTput. Arduino IDE

The function for writing in a digital output using Arduino IDE is DigitalWrite().  This function is used to set a digital output to high or low level.

 On Industrial Shields equipment’s is followed with the corresponding pinout. These functions are normally used inside the loop() function.

*With next version of Industrial Shields boards won’t be necessary to configure the pins, just selecting the properly board, I/O’s will be automatically configured. 

Next is showed the syntax:

DigitalWrite(pin, value);

Pin: Could be any industrial shields equipment pin or any Arduino board pin that you wish to set. 

Value: HIGH or LOW (See more information on Arduino references)

Code Example, blinking of two digital outputs:

void setup() {
  pinMode(Q0_1, OUTPUT);
}

void loop() {
  digitalWrite(Q0_1, HIGH);
  delay(1000);             // delay 1s

  digitalWrite(Q0_1, LOW);
  delay(1000);
}

SEE ALSO: HOW TO USE THE MAPPING PINS OF INDUSTRIAL SHIELDS BOARDS, HOW TO READ A DIGITAL INPUT. ARDUINO IDE, HOW TO WRITE AN ANALOG OUTPUT. ARDUINO IDE, HOW TO READ AN ANALOG INPUT, HOW TO READ AN ANALOG INPUT. ARDUINO IDE

 

Comments are closed.