Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. 3 Switch Pins but 1 Not Updating Vera

3 Switch Pins but 1 Not Updating Vera

Scheduled Pinned Locked Moved Development
pro minipinsswitches
6 Posts 4 Posters 2.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    smokey1300
    wrote on last edited by
    #1

    Having trouble getting the Pro-mini Arduino pins to update my Veralite. As you see the send looks like it should be updating but nothing or maybe I am missing something. In my sketch I am using pins 3,4,5 and pins 3 and 5 are updating fine. I'm running MySensors Plugin V1.4 and API v1.5 and UI7.

    .Anduino_serial.jpg
    Vera_status.jpg

    #include <MySensor.h>
    #include <SPI.h>
    #include <Bounce2.h>
    
    #define NUMBER_OF_SWITCHES 3
    #define RADIO_ID 88
    
    MySensor gw;
    Bounce debouncer[NUMBER_OF_SWITCHES];
    
    int oldValue[NUMBER_OF_SWITCHES];
    byte switchPin[NUMBER_OF_SWITCHES] = {3,4,5}; //<<<<<<<<<<< set your switch pins here
    
    MyMessage msg(RADIO_ID,V_TRIPPED);
    
    void setup()  
    {  
      gw.begin(NULL, RADIO_ID, false);
      // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Garage Node", "1.2c");
      
      for (int i = 0; i < NUMBER_OF_SWITCHES; i++)
      {
        pinMode(switchPin[i],INPUT_PULLUP);
        debouncer[i] = Bounce();
        debouncer[i].attach(switchPin[i]);
        debouncer[i].interval(5);
      }
      for (int i = 0; i < NUMBER_OF_SWITCHES; i++)
      {
        gw.present(i, S_DOOR);
        gw.wait(250);
      }
    }
    //
    void loop() 
    {
      for (int i = 0; i < NUMBER_OF_SWITCHES; i++)
      {
        debouncer[i].update();
        int value = debouncer[i].read();
        if (value != oldValue[i]) 
        {
          gw.wait(250);
          gw.send(msg.setSensor(i).set(value==LOW ? true : false),false); 
        }
        oldValue[i] = value;
      }
    } 
    
    BulldogLowellB 1 Reply Last reply
    0
    • S smokey1300

      Having trouble getting the Pro-mini Arduino pins to update my Veralite. As you see the send looks like it should be updating but nothing or maybe I am missing something. In my sketch I am using pins 3,4,5 and pins 3 and 5 are updating fine. I'm running MySensors Plugin V1.4 and API v1.5 and UI7.

      .Anduino_serial.jpg
      Vera_status.jpg

      #include <MySensor.h>
      #include <SPI.h>
      #include <Bounce2.h>
      
      #define NUMBER_OF_SWITCHES 3
      #define RADIO_ID 88
      
      MySensor gw;
      Bounce debouncer[NUMBER_OF_SWITCHES];
      
      int oldValue[NUMBER_OF_SWITCHES];
      byte switchPin[NUMBER_OF_SWITCHES] = {3,4,5}; //<<<<<<<<<<< set your switch pins here
      
      MyMessage msg(RADIO_ID,V_TRIPPED);
      
      void setup()  
      {  
        gw.begin(NULL, RADIO_ID, false);
        // Send the sketch version information to the gateway and Controller
          gw.sendSketchInfo("Garage Node", "1.2c");
        
        for (int i = 0; i < NUMBER_OF_SWITCHES; i++)
        {
          pinMode(switchPin[i],INPUT_PULLUP);
          debouncer[i] = Bounce();
          debouncer[i].attach(switchPin[i]);
          debouncer[i].interval(5);
        }
        for (int i = 0; i < NUMBER_OF_SWITCHES; i++)
        {
          gw.present(i, S_DOOR);
          gw.wait(250);
        }
      }
      //
      void loop() 
      {
        for (int i = 0; i < NUMBER_OF_SWITCHES; i++)
        {
          debouncer[i].update();
          int value = debouncer[i].read();
          if (value != oldValue[i]) 
          {
            gw.wait(250);
            gw.send(msg.setSensor(i).set(value==LOW ? true : false),false); 
          }
          oldValue[i] = value;
        }
      } 
      
      BulldogLowellB Offline
      BulldogLowellB Offline
      BulldogLowell
      Contest Winner
      wrote on last edited by
      #2

      @smokey1300

      Have you tried using external pullup resistors instead of the internal?

      S 1 Reply Last reply
      0
      • BulldogLowellB BulldogLowell

        @smokey1300

        Have you tried using external pullup resistors instead of the internal?

        S Offline
        S Offline
        smokey1300
        wrote on last edited by smokey1300
        #3

        @BulldogLowell Thanks I will try that in the future it's a bit hard SMD resistors.

        If you see the last line on the serial monitor it looks to me it appears to be sending the data...right?

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #4

          Yes, looks like it is transmitting.

          How SHOULD the visual feedback for door sensor in UI7 behave?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            akbooer
            wrote on last edited by akbooer
            #5

            It should have red bars above the icon.

            image.jpg

            S 1 Reply Last reply
            0
            • A akbooer

              It should have red bars above the icon.

              image.jpg

              S Offline
              S Offline
              smokey1300
              wrote on last edited by
              #6

              @akbooer Yes this is what I was seeing on UI7 but nothing on sensor pin for sensor door 1. I was powering it from my USB but I changed it to board(MYS11) power 5v and now it sends the data.

              This is good now but now I see delays and some times 2 sensors report both on but only 1 is grounded. I'm not sure if that has to do with debounce timers perhaps?

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              13

              Online

              11.7k

              Users

              11.2k

              Topics

              113.0k

              Posts


              Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular