Basic Library
Digital I/O
Analog I/O
Advanced I/O
Time
Math
Trigonometry
Random Numbers
Bits and Bytes
Interrupts
Serial Comm.
Standard Library
Servo Motor
Stepping Motor
Liquid Crystal
EEPROM
SPI
I2C (Wire)
SD Card
SD (File Operations)
Ethernet
Ethernet (Server)
Ethernet (Client)
Firmata
Periodic Operation
Power Save
Clock (RTC)
SoftwareSerial
Utility
Digital I/O
This GR-KURUMI sketch reference library is used to input/output a digital signal (0 or 1).
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 whose mode you wish to set
mode: INPUT, OUTPUT or INPUT_PULLUPReturns
None
Remark
Analog pins A0 to A5 (14 to 21) have no internal pull-up registers. Do not specify INPUT_PULLUP for these pins.
digitalWrite
Description
Write a HIGH or a LOW value to a digital pin. If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal pullup resistor. Writing LOW will disable the pullup.
Syntax
digitalWrite(pin, value)
Parameters
pin: The pin number
value: HIGH or LOWReturns
none
digitalRead
Description
Reads the value from a specified digital pin, either HIGH or LOW.
Syntax
digitaRead(pin)
Parameters
pin: The number of the digital pin you want to read
Returns
HIGH or LOW
Example
When connecting an LED to the 0 pin, the LED is lit periodically.
#include <Arduino.h>
void setup()
{
pinMode(0, OUTPUT);
}
void loop()
{
digitalWrite(0, 1);
delay(100);
digitalWrite(0, 0);
delay(100);
}