I hace everything ready, fetching from the website but, the motors are not working. In Arduino Uno works but in NodeMCU did not.
The selenoid motor is this one from AliExpress: the 3v --> https://es.aliexpress.com/item/4000807560712.html
The circuit I made is like this:
NodeMCU / Motor
D2 -> Positive motor wire (red wire).
3.3V -> Positive motor wire (red wire).
GND -> Negative motor wire (black wire).
All this is attached to a protoboard for easy my work, but those are the connections of the circuit.
At otherwise, the code looks something like this:
void setup() {
Serial.begin(115200);
pinMode(D2, OUTPUT);
}
void loop() {
analogWrite(D2, 0);
delay(3000);
analogWrite(D2, 100);
delay(3000);
}
I also tried instead of pin name D2 use 4 corresponding of the GPIO number. Didn't work.
The wired part is in Arduino Uno the same code and same circuit works perfectly, but in NodeMCU not.