不使用开关或继电器读取 LED 状态
Read LED state without using switch or relay
这是一个非常愚蠢的问题。我是电子和 Arduino 的新手。我想知道我是否可以获得与 9V 电池连接的 LED 的当前状态。
我正在使用 NodeMCU v3 Wifi。
我尝试使用 digitalRead 进行读取,但无论如何它总是返回 1。
int ledPin = 13;
int inPin = 12;
int val = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(inPin, INPUT);
}
void loop() {
val = digitalRead(inPin);
digitalWrite(ledPin, val);
}
我想知道的是,如果我通过 WiFi 使用 nodemcu/arduino 打开某些设备,有什么方法可以检查设备是否真的打开了?
Is there any way to check that the equipment is really ON?
根据设备的类型,您可以:
a) 测量通过设备的电流
b) 感知设备(光、热……)
c) 测量设备两端的电压
d) 尝试与设备通信
e) ...
这是一个非常愚蠢的问题。我是电子和 Arduino 的新手。我想知道我是否可以获得与 9V 电池连接的 LED 的当前状态。
我正在使用 NodeMCU v3 Wifi。
我尝试使用 digitalRead 进行读取,但无论如何它总是返回 1。
int ledPin = 13;
int inPin = 12;
int val = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(inPin, INPUT);
}
void loop() {
val = digitalRead(inPin);
digitalWrite(ledPin, val);
}
我想知道的是,如果我通过 WiFi 使用 nodemcu/arduino 打开某些设备,有什么方法可以检查设备是否真的打开了?
Is there any way to check that the equipment is really ON?
根据设备的类型,您可以:
a) 测量通过设备的电流
b) 感知设备(光、热……)
c) 测量设备两端的电压
d) 尝试与设备通信
e) ...