🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Adding a switch to the DinMeter

    Units
    1
    3
    118
    Loading More Posts
    • 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.
    • C
      cdnstig
      last edited by

      I am trying to add an external switch to the DinMeter, but am having trouble reading the stitch closure. If I prototype this on an Arduino Uno, I have no issues and it works as expected. Is there a chance that I'm not calling the proper pin? I am trying to use G1 on PortB as I suspect that is the proper one. Or is there a chance that I can't do a digitalRead on that pin for the switch to work?

      int switchPin = G1;
      int switchValue = 0;

      void setup() {
      pinMode(switchPin, INPUT_PULLUP);
      }

      void loop() {
      if (switchValue = digitalRead(switchPin) == LOW) {
      do something...
      }
      }

      Thanks.

      C 2 Replies Last reply Reply Quote 0
      • C
        cdnstig @cdnstig
        last edited by

        In case anyone else comes across this post, it appears that the wires coming out of the DinMeter PortB are reversed to the label, at least on my unit. G1 is the yellow wire, and G2 is the white one. It works as expected to do a digital read on the pins for a button push.

        1 Reply Last reply Reply Quote 0
        • C
          cdnstig @cdnstig
          last edited by

          In case anyone else comes across this post, it appears that the wires coming out of the DinMeter PortB are reversed to the label, at least on my unit. G1 is the yellow wire, and G2 is the white one. It works as expected to do a digital read on the pins for a button push.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post