Breakout encodeur rotatif PWM à 360 degrés

Breakout encodeur rotatif PWM à 360 degrés

$7.81 $7.81 USD
Model #AD-PB928027
Quantity
We have 6 of these in stock We have 6 of these in stock
and you currently have in your cart.
In Stock

Add 

Warranty Plus

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.

Standard Warranty:
12 month warranty comes with every purchase. Covers malfunctions when it is used within the described conditions/limits.

 +8%  ($0.62) ($0.62)

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.

  • Description

    Ce type de commutateur est un encodeur rotatif incrémentiel. En fait, il est le plus largement utilisé de tous les encodeurs rotatifs en raison de son faible coût et de sa capacité à fournir des signaux qui peuvent être facilement interprétés pour fournir des informations liées au mouvement telles que la vitesse.

    En tournant, le codeur rotatif peut compter la fréquence d'impulsion de sortie dans une direction positive et inverse pendant la rotation, contrairement à un compteur du potentiomètre rotatif sans limitation de comptage. Avec le bouton de l'encodeur rotatif, il peut être réinitialisé à son état initial à partir de zéro.

  • Code de test

    int redpin = 2;
    int yellowpin = 3;
    int greenpin = 4;
    int apin = 6;
    int bpin = 7;
    int boutonnage = 5;
    int state = 0;
    int longperiod = 5000; // Temps au vert ou au rouge
    int shortperiod = 700; // période de temps en changeant
    int cibleCount = shortperiod;
    int count = 0;
    void setup()
    {
      pinmode (apin, entrée);
      pinmode (bpin, entrée);
      pinmode (boutonpin, entrée);
      PinMode (Redpin, sortie);
      PinMode (Yellowpin, sortie);
      PinMode (Greenpin, sortie);
    }
    VOID LOOP ()
    {
      Count ++;
      if (DigitalRead (Buttonpin))
      {
      Setlights (haut, haut, haut);
      }
      autre
      {
      int changement = getEncoderTurn ();
      int newperiod = longPeriod + (changement * 1000);  
      if (newperiod> = 1000 && newperiod <= 10000)
        {
      Longperiod = newperiod;
        }
      if (compter> cibleCount)
        {
      setState ();
      count = 0;
        }
      }
      retard (1);
    }
    int getEncoderTurn ()
    {

     // retour -1, 0 ou +1
      statique int oldia = bas;
      static int oldb = bas;
      INT Result = 0;
      int newa = digitalread (apin);
      int NewB = DigitalRead (bpin);
      if (newa! = ola || newb! = oldb)
      {
      // quelque chose a changé
      if (olda == Low && newa == high)
        {
      résultat = - (oldb * 2 - 1);
        }
      }
      OLDA = NEWA;
      oldb = newb;
      Résultat de retour;
    }
    int setState ()
      {
      if (état == 0)
        {
      Setlights (haut, bas, bas);
      TargetCount = LongPeriod;
      état = 1;
        }
      sinon si (état == 1)
        {
      Setlights (haut, haut, bas);
      TargetCount = Shortperiod;
      état = 2;
        }
      else if (état == 2)
        {
      Setlights (bas, bas, haut);
      TargetCount = LongPeriod;
      état = 3;
        }
      else if (état == 3)
        {
      Setlights (bas, haut, bas);
      TargetCount = Shortperiod;
      état = 0;
        }
      }
    vide setlights (int rouge, int jaune, int green)
    {
      DigitalWrite (Redpin, rouge);
      DigitalWrite (Yellowpin, jaune);
      DigitalWrite (Greenpin, Green);

Frequently Bought Together

Total Price: $0.00 USD