360 Derece PWM Döner Kodlayıcı Koparma

      360 Derece PWM Döner Kodlayıcı Koparma

      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.

      Açıklama

      Bu tür anahtar, artımlı döner kodlayıcıdır.  Nitekim, düşük maliyeti ve hız gibi hareketle ilgili bilgileri sağlamak için kolayca yorumlanabilecek sinyaller sağlama yeteneği nedeniyle tüm döner kodlayıcılar arasında en yaygın olarak kullanılan kaynaktır.

      Döner kodlayıcı döner darbe frekansını, sayma sınırlaması olmaksızın döner potansiyometre sayAcının aksine, dönüş sırasında pozitif ve ters yönde sayabilir. Döner kodlayıcıüzerindeki düğme ile sıfırlanabilir ve sıfırlanabilir.

      Test kodu

      int redPin = 2;
      int yellowPin = 3;
      int greenPin = 4;
      int aPin = 6;
      int bPin = 7;
      int buttonPin = 5;
      int durum = 0;
      int longPeriod = 5000; Yeşil veya kırmızı da zaman
      int kısaDönem = 700; Değiştirirken zaman dilimi
      int targetCount = kısaDönem;
      int sayısı = 0;
      void kurulum()
      {
      pinMode(aPin, INPUT);
      pinMode(bPin, INPUT);
      pinMode(buttonPin, INPUT);
      pinMode(redPin, OUTPUT);
      pinMode(yellowPin, OUTPUT);
      pinMode(greenPin, OUTPUT);
      }
      void döngü()
      {
      count++;
      if (digitalRead(buttonPin))
        {
      setLights (YÜKSEK, YÜKSEK, YÜKSEK);
        }
      Başka
        {
      int change = getEncoderTurn();
      int newPeriod = longPeriod + (değişim * 1000);
      if (newPeriod >= 1000 & newPeriod <= 10000)
          {
      longPeriod = newPeriod;
          }
      if (hedefSayısı > say)
          {
      setState();
      sayım = 0;
          }
        }
      gecikme(1);
      }
      int getEncoderTurn()
      {

      return -1, 0 veya +1
      statik int oldA = DÜŞÜK;
      statik int oldB = DÜŞÜK;
      int sonuç = 0;
      int newA = digitalRead(aPin);
      int newB = digitalRead(bPin);
      if (newA != oldA || newB != oldB)
        {
      bir şey değişti
      if (oldA == LOW & newA == HIGH)
          {
      sonuç = -(oldB * 2 - 1);
          }
        }
      oldA = newA;
      oldB = newB;
      dönüş sonucu;
      }
      int setState()
        {
      if (durum == 0)
          {
      setLights (YÜKSEK, DÜŞÜK, DÜŞÜK);
      targetCount = longPeriod;
      durum = 1;
          }
      else if (durum == 1)
          {
      setLights (YÜKSEK, YÜKSEK, DÜŞÜK);
      targetCount = kısaDönem;
      durum = 2;
          }
      else if (durum == 2)
          {
      setLights (DÜŞÜK, DÜŞÜK, YÜKSEK);
      targetCount = longPeriod;
      durum = 3;
          }
      else if (durum == 3)
          {
      setLights (LOW, HIGH, LOW);
      targetCount = kısaDönem;
      durum = 0;
          }
        }
      void setLights(int kırmızı, int sarı, int yeşil)
      {
      digitalWrite(redPin, kırmızı);
      digitalWrite(yellowPin, sarı);
      digitalWrite(greenPin, yeşil);