URI: 
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       mc-Things
  HTML https://mcthings.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: mc-Plug
       *****************************************************
       #Post#: 1891--------------------------------------------------
       Getting started with a mcPlug
       By: Veleek Date: April 1, 2017, 11:28 pm
       ---------------------------------------------------------
       I just received my mcPlugs and I'm trying to figure out how to
       get started.  It looks like I need to provide my own power
       cables, I've got to see if I can find anything that matches
       this, but I was kind of expecting to have the cables included.
       How do we go about controlling the mcPlug?  Are there any
       examples of code that I can use to work with them?
       #Post#: 1894--------------------------------------------------
       Re: Getting started with a mcPlug
       By: mc-T2 Date: April 3, 2017, 9:54 am
       ---------------------------------------------------------
       Hey Veleek,
       Glad you received your plugs! We were trying to get a project
       done using the mcPlug last week to showcase on Hackster.io
       however this didn't quite happen - mostly because we were too
       busy setting up the new website (It is live now so check it
       out!).
       We are going to try and put together a project to showcase the
       mcPlug and some of the cool things you can do with it this week.
       In the meantime, below is some code to help you get going:
       [code]Class mcPlugSub
       Const mcPlugTopic As String = "mcThings/plug"
       Shared Event Boot()
       Lplan.SetMidPowerMode(1)
       Lplan.Subscribe(mcPlugTopic)
       End Event
       Shared Event SubscriptionDelivery()
       Dim msg As Message = Lplan.GetDelivery()
       If msg.Topic= mcPlugTopic Then
       Relay = Not Relay
       End If
       End Event
       End Class
       [/code]
       The above code sets the plug to be in mid-power mode (basically
       a constant connection to the mcGateway). If the device receives
       the MQTT topic "mcThings/plug" it will then turn on the relay
       and provide power to whatever you have connected to the plug!
       Some examples of what you can do:
       - Setup a fan connected to the plug. You can then have another
       module checking temperature and if too hot, then it can send a
       message and turn on the fan
       - I have setup a module connected to a switch/button (there is
       also a switch built-in to the mcModules too!) that can turn on
       or off the relay on the plug.
       We'll do our best to get a project up this week to give you a
       better starting point. Hope that helps!
       *****************************************************