Digital I/O

pinMode(pin, [INPUT | OUTPUT | INPUT_PULLUP | INPUT_DOWN])
digitalWrite(pin, [HIGH | LOW])
digitalRead(pin)

Example:

function setup() {
  pinMode(D0, OUTPUT);
  pinMode(D34, INPUT);
}

function loop() {
  let value = digitalRead(D34);
  digitalWrite(D0, value);
}

Similar to Arduino, these commands configure, write and read a digital GPIO pin.

The possible values for pin are:

PinAliasDirectionDescription
0D0In/OutBuilt-in LED / GPIO0
16D16In/OutUART1 Rx / GPIO16
17D17In/OutUART1 Tx / GPIO17
18D18In/OutSPI SCK / GPIO18
19D19In/OutSPI MISO / GPIO19
23D23In/OutSPI MOSI / GPIO23
25D25In/OutDAC1 / ADC2_CH8 / GPIO25
26D26In/OutDAC2 / GPIO26
27D27In/OutI2C SDA / GPIO27
32D32In/OutI2C SCL / GPIO32
33D33In/OutADC1_CH5 / GPIO33
34D34InExternal Interrupt
36D36InADC1_CH0 / GPIO36