 Asif138
		
			Asif138
		
		
		
		
		
		
		
		
	
			07-10-2017 06:13 AM
Dear Friends,
how can i compare system time with set time by user to turn on/off any LED.
Let say i want one LED to turn on every evening at 5pm and turn off every morning at 6am???
Thanks,
Asif Iqbal
 sridhar..reddy
		
			sridhar..reddy
		
		
		
		
		
		
		
		
	
			07-10-2017 06:25 AM
You can do this.
07-10-2017 06:44 AM
not working...
 GerdW
		
			GerdW
		
		
		 
		
		
		
		
		
	
			07-10-2017 06:50 AM
 Bob_Schor
		
			Bob_Schor
		
		
		 
		
		
		
		
		
	
			07-10-2017 07:13 AM
@Asif138 wrote:
Dear Friends,
how can i compare system time with set time by user to turn on/off any LED.
Let say i want one LED to turn on every evening at 5pm and turn off every morning at 6am???
Hi, Asif. Can I assume that you are just learning LabVIEW, and maybe are also fairly new to Programming, in general?
The first thing to think about is how do you really want your code to function. Suppose I read the time and it is 5:01 PM. What do you want your code to do? Suppose it is 5:00:00.0001 PM. Note that it may be "highly unlikely" that the time will ever be exactly 5:00 PM.
The next thing to think about is that you are concerned only with a 24-hour clock, not with the date.
Closely related to the first point is how often you want to check the time. I assume you don't want the program to spend 99.9999% of the time checking-and-doing-nothing because it is not "turn-on" or "turn-off" time. If it "wakes up" and checks every 5 minutes, then 99.9999% of the time the computer can be doing other, more useful, things, and you'll turn on and off "close" to the right time.
Take a look at the Seconds to Date/Time function, and read its Help to see how it works. You can use it to give you the Minute (0 to 59) and Hour (0 to 23) when it is called. That, and a little logic (and possibly some arithmetic) should provide a solution for you.
Bob Schor
 sridhar..reddy
		
			sridhar..reddy
		
		
		
		
		
		
		
		
	
			07-10-2017 08:33 AM
It works buddy.
here i am posting the vi.
Try by modifying your system time and modify the desired time in string constant.
 RavensFan
		
			RavensFan
		
		
		 
		
		
		
		
		
	
			07-10-2017 08:41 AM
@sridhar..reddy wrote:
It works buddy.
here i am posting the vi.
Try by modifying your system time and modify the desired time in string constant.
And exactly how does that answer the question?
That VI return a True for only 1 second of the day.
 sridhar..reddy
		
			sridhar..reddy
		
		
		
		
		
		
		
		
	
			07-10-2017 11:52 PM
TRY THIS
 GerdW
		
			GerdW
		
		
		 
		
		
		
		
		
	
			07-11-2017 02:07 AM
 sridhar..reddy
		
			sridhar..reddy
		
		
		
		
		
		
		
		
	
			07-11-2017 02:15 AM
yes you are right.
Thanks.