Hey guys,
First and foremost, my degree of knowledge in electronics is shallow at its best, and thus why I'm asking you guys for help and thanks
That said, the problem in hands is somewhat the very basic of electronics, but I just want to validate my idea and the schematics, before I fried my personal computer, and actually try to figure out if this is going to work after all.
So basically I'm simulating the power switch button using an esp8266, the power switch of the computer basically connects common to the input when pressed, and runs on 5V.
A simple schematics that shows the above. H1 is the power switch of the computer, connected to the esp8266 H2 is connected to the computer, and will act as the simulated switch R1 & R2 I'm not entirely sure if I need these?
I will leave comments on the electronics to others, but as to the code, you only need to set the pinMode() once so do it in setup(). Did you perhaps mean to set the output LOW then HIGH when the event is triggered ?
Basically I want to preserve the two methods for powering on the computer, pushing the button, as usual, and sending an EVENT to the esp.
As my understanding that to simulate the power button I only need to short it with the ground, thus why I'm setting the pinMode() to INPUT in the setup, to prevent the computer to turn on immediately, and setting it to OUTPUT when an event has been triggered.
I think if I had this configuration:
#define WOL 20
void setup() {
Serial.begin(115200);
pinMode(WOL, OUTPUT);
}
void loop() {
if([SOME_EVENT]) {
digitalWrite(WOL, HIGH);
delay(300);
digitalWrite(WOL, LOW);
}
}
the pc would turn on as soon as the setup is initialized.