update NodeMCU pin
Posted: Tue Dec 24, 2019 10:00 am
Hello all,
I'm i need of a little hand...
i'm trying to make my coffee machine "smart", but im having a little problem, i need to identify if the coffee machine is on at the moment or not.
I need to read the state of a pin (D7) depending if there's a 3.3v there or not...
I mean, if i put 3.3v to D7 it should return me "HIGH or 1", and when i remove the 3.3v it should show me "LOW or 0", but when i put 3.3v it remains high until i connect it to gnd
This is the code i have:
I'm i need of a little hand...
i'm trying to make my coffee machine "smart", but im having a little problem, i need to identify if the coffee machine is on at the moment or not.
I need to read the state of a pin (D7) depending if there's a 3.3v there or not...
I mean, if i put 3.3v to D7 it should return me "HIGH or 1", and when i remove the 3.3v it should show me "LOW or 0", but when i put 3.3v it remains high until i connect it to gnd
This is the code i have:
Code: Select all
#define power D7
void setup() {
Serial.begin(115200);
pinMode(power, INPUT);
}
void loop() {
digitalWrite(power, !digitalRead(power));
Serial.println (digitalRead(power));
delay(1000);
}