Author Topic: mcModule as doorbell  (Read 620 times)

mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: mcModule as doorbell
« on: August 14, 2018, 10:43:08 am »
Hey michaelblight,

yes, I havent seen anyone post this project yet, however, we have done this ourselves and i know of some users who have done a button onto a mcModule. The mcModule includes a small button/switch already but if you wished, you could connect a push button and use it for a doorbell (or other purposes).

Since you are working on the older version (legacy) of the mcThings platform, you will need to work with some older code. NOTE - We are moving towards the public release of mcCloud in the next month or two so keep an eye out as the new version of mcCloud is very versatile and makes it much easier to work with multiple devices! Older equipment will not work on the new system but we are going to be offering our users discounted hardware for those who want to move to the new system. It should also be noted that we are no longer supporting the legacy system (no new firmware, big fixes, etc) as we are focusing on the new version.

Button code: The below is a code we used to send information to the IFTTT service but you can modify it to send the info to elsewhere if you wish. A standard pushbutton was soldered to PIN 0 and GRD from the button and then the device was loaded with the below code:


Code: [Select]
Class ButtonExample
   
    //The following will send an IFTTT message when the button is pressed & will light the LED when pressed
    Shared Event ButtonPressed()
        Thread.Sleep(50000)
        Thread.ClearHardwareEvent()
        'If Pin0 = False Then
        If Button0 = False Then
            Lplan.IFTTT("YOURIFTTTWEBHOOKKEYHERE", "BUTTON", "pressed")
            LedGreen = True // turn off LED
            Thread.Sleep(100000)
            LedGreen = False
            Thread.Sleep(120000000)
        End If       
    End Event   
End Class

From there, we setup an IFTTT applet which would send a notification/email/text when the button is pressed. Note, there can sometimes be some lag as you are working with a third-party service.. sometimes it is lightening fast and other times it can take up to a minute. You will also need to test and ensure that your mcGateway is in range of the device.
Hope that helps, good luck and when the new version of mcCloud is out, we will be pushing out the same above example for a button so you can do this on the new system.
Thanks
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