hi guys, first i have this tools
1- Arduino ONU
2- Relay
3- RTC
and i have laptop i get two wire from power button, see this images please
now i need turn on my laptop on custome times, example:
i have 3 times
11:30 AM
16:02 PM
03:09 AM
i need my laptop turn on in theese times
how can i make that can anyone help me please
Where are you stuck ?
Can you read the time from the RTC and print it ?
Can you read the time from the RTC and print it ?
yes i can see my times and print it
this is my code bro
#include<Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
int relay =12;
void setup ()
{
pinMode(relay, OUTPUT);
digitalWrite(12, HIGH);
Serial.begin(9600);
Wire.begin();
RTC.begin(); // load the time from your computer.
//Reset the date time
//RTC.adjust(DateTime(__DATE__, __TIME__));
}
void loop ()
{
DateTime now = RTC.now();
String mytime = (String)now.hour() + ":" + (String)now.minute() + ":" + (String)now.second();
if (mytime == "3:20:0" ) {
runpc();
}
if (mytime == "10:47:0" ) {
runpc();
}
if (mytime == "18:30:0" ) {
runpc();
}
Serial.println(mytime);
delay(1000);
}
void runpc() {
digitalWrite(relay,HIGH);
delay(500);
digitalWrite(relay,LOW);
delay(1000);
}
not work idk why
What do you see when you print mytime ?
Does the runpc() function ever get called ?
void runpc() {
digitalWrite(relay,HIGH);
delay(500);
digitalWrite(relay,LOW);
delay(1000);
}
most relay modules turn on when a LOW signal is applied so is the function doing what you want ?
please can you explian more easy i don't know what you mean
Which part don't you understand ?
hmmm can you tell me what should i do step by step
Start by posting what you see when you print mytime
ok bro i do that, and i see this output
1:2:0
1:2:0
1:2:0
1:2:0
1:2:0
1:2:0
1:2:0
1:2:0
1:2:0
1:2:0
1:2:0
How does your relay turn on your laptop? It looks like you have two wires stuck under some keyboard keys but it is not clear where they connect to the laptop hardware. I don't see a "Power" button anywhere near where the wires are poked in.
system
Closed
June 11, 2023, 2:46pm
11
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.