মূল বিষয়বস্তুতে যান
Back to Reference
Arduino API

digitalWrite() and digitalRead()

Switch outputs and read inputs as HIGH or LOW.

Example
digitalWrite(pin, HIGH);  // or LOW
int v = digitalRead(pin); // HIGH (1) or LOW (0)

An input reads HIGH above roughly 60 % of the supply voltage (3 V on the Uno, about 2.5 V on the ESP32) and LOW below about 30 %. In between the result is undefined — another reason to avoid floating inputs.