Digital I/O

The GR-ROSE library is for configuring the digital signal (HIGH/LOW) to function as either input or output.

pinMode

Description
Configures the specified pin to behave either as an input or an output.
Syntax
pinMode(pin, mode)
Parameters
pin: The number of the pin to set
mode:
INPUT
OUTPUT
INPUT_PULLUP (pullup then input)
OUTPUT_OPENDRAIN
Returns
None

digitalWrite

Description
Write a HIGH or a LOW value to a digital pin.
Syntax
digitalWrite(uint8_t pin, uint8_t value)
Parameters
pin: The pin number
value: HIGH or LOW
Returns
none

digitalRead

Description
Reads the value from a specified digital pin, either HIGH or LOW.
Syntax
digitalRead(uint8_t pin)
Parameters
pin: The pin number
Returns
HIGH or LOW

Sample Program

Sample for digitalWrite and digitalRead.


#include <Arduino.h>
void setup() {
  // put your setup code here, to run once:
  pinMode(PIN_LED1, OUTPUT);
 
}
 
void loop() {
  // put your main code here, to run repeatedly: 
  digitalWrite(PIN_LED1, HIGH);
  delay(100);
  digitalWrite(PIN_LED1, LOW);
  delay(100);
}