Author Topic: How can I put an mcMod120 in sleep mode for 10 minutes and then run the program?  (Read 30 times)

Junkboy

  • Newbie
  • *
  • Posts: 11
    • View Profile
Basically what I want is to put the mcMod120 to send data 60 minutes, then put it in sleep mode for 20 minutes, then again 60 minutes sending and 20 minutes in sleep mode, and this is repeated infinitely.

I currently use this line to send data every 5 seconds:
Shared Event Publish() RaiseEvent Every 5 Seconds

What I'm going to do, is put in place of 5 seconds, 60 minutes, and I'm looking for a function to put:

Sleep (20 min)

And let this start again ..

Social Buttons


mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Hi Junkboy,

yes, you can insert a 'sleep' function into your code. Check out the attached mcScript guide (Also available on the website) and search through it for the function. I think i remember that it is discussed or displayed on page 23 (and other areas within the document).

The concept would be, to complete what you are asking below, is to raise an event every 60 minutes, insert the sleep function for a certain period of time (I believe the sleep function calculates time in milliseconds so you'll need to do some conversion). Should allow you to do what you are asking below.

Good luck!
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB