Skip to content
On this page

Digital read ⏪

This action changes changes the signal of a digital I/O pin to either LOW or HIGH.


EmulatorArduinoESP IDFZephyr
Support

Interface

wasm
(func chip_digital_read (param $pin i32) (result i32))
ts
function digitalRead(pin: i32, value: PinVoltage): void
rust
fn digital_read(pin: u32, value: PinVoltage)

Parameters

WebAssembly

  • pin: must be a valid I/O pin number of the microcontroller

Return value

WebAssembly

  • a unsigned 32 integer, either 0 (low) or 1 (high)

AssemblyScript

ts
enum PinVoltage {
    /** Low voltage on a digital I/O pin */
    LOW  = 0,
    /** High voltage on a digital I/O pin */
    HIGH = 1,
}

Rust

rust
enum PinVoltage {
    /** Low voltage on a digital I/O pin */
    LOW  = 0,
    /** High voltage on a digital I/O pin */
    HIGH = 1,
}