360 graden PWM roterende encoder breakout

      360 graden PWM roterende encoder breakout

      USD
      Model #
      Quantity
      qty limit cart limit

      Add Warranty Plus +8%

      Standard Warranty (included in purchase price): 12 month warranty due to device malfunctions when it is used within the described conditions/limits.

      Warranty Plus: Your product will be replaced (including free shipping) with a new one within 12 months of purchase, even if it is damaged due to improper wiring, incorrect usage, a problem in the electrical installation or any other circumstance.

      Shipping Cost Estimator

      Note: You must have items in your cart already before you can see the estimated costs to ship your cart. This shipping tool will estimate the total shipping cost for your entire basket.

      Omschrijving

      Dit type schakelaar is een incrementele roterende encoder. In feite is het de meest gebruikte van alle roterende encoders vanwege de lage kosten en het vermogen om signalen te leveren die gemakkelijk kunnen worden geïnterpreteerd om bewegingsgerelateerde informatie zoals snelheid te leveren.

      Door te roteren, kan de roterende encoder de outputpulsfrequentie in positieve en omgekeerde richting tellen tijdens rotatie, in tegenstelling tot een roterende potentiometerteller zonder telbeperking. Met de knop op de roterende encoder kan deze vanaf nul worden gereset naar de oorspronkelijke status.

      Code testen

      int redPin = 2;
      int yellowPin = 3;
      int greenPin = 4;
      int aPin = 6;
      int bPin = 7;
      int buttonPin = 5;
      int staat = 0;
      int longPeriod = 5000; // Tijd op groen of rood
      int shortPeriod = 700; // Tijdsperiode bij verandering
      int targetCount = shortPeriod;
      int count = 0;
      leegte setup ()
      {
      pinMode (aPin, INPUT);
      pinMode (bPin, INPUT);
      pinMode (buttonPin, INPUT);
      pinMode (redPin, OUTPUT);
      pinMode (yellowPin, OUTPUT);
      pinMode (greenPin, OUTPUT);
      }
      leegte lus ()
      {
      tel ++;
      if (digitalRead (buttonPin))
        {
      setLights (HIGH, HIGH, HIGH);
        }
      anders
        {
      int verandering = getEncoderTurn ();
      int newPeriod = longPeriod + (wijziging * 1000);
      if (newPeriod> = 1000 && newPeriod <= 10000)
          {
      longPeriod = newPeriod;
          }
      if (count> targetCount)
          {
      setState ();
      count = 0;
          }
        }
      vertraging (1);
      }
      int getEncoderTurn ()
      {

      // retourneer -1, 0 of +1
      static int oldA = LOW;
      static int oldB = LOW;
      int resultaat = 0;
      int newA = digitalRead (aPin);
      int newB = digitalRead (bPin);
      if (newA! = oldA || newB! = oldB)
        {
      // iets is veranderd
      if (oldA == LAAG && newA == HOOG)
          {
      resultaat = - (oudB * 2 - 1);
          }
        }
      oldA = newA;
      oldB = newB;
      resultaat teruggeven;
      }
      int setState ()
        {
      if (staat == 0)
          {
      setLights (HIGH, LOW, LOW);
      targetCount = longPeriod;
      staat = 1;
          }
      else if (staat == 1)
          {
      setLights (HIGH, HIGH, LOW);
      targetCount = shortPeriod;
      staat = 2;
          }
      else if (staat == 2)
          {
      setLights (LOW, LOW, HIGH);
      targetCount = longPeriod;
      staat = 3;
          }
      else if (staat == 3)
          {
      setLights (LOW, HIGH, LOW);
      targetCount = shortPeriod;
      staat = 0;
          }
        }
      void setLights (int rood, int geel, int groen)
      {
      digitalWrite (redPin, rood);
      digitalWrite (yellowPin, geel);
      digitalWrite (greenPin, groen);

      Frequently Bought Together

      Total Price: