360度PWMロータリーエンコーダーブレイクアウト

360度PWMロータリーエンコーダーブレイクアウト

$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.

  • 説明

    このタイプのスイッチは、インクリメンタルロータリーエンコーダーです。実際のところ、低コストと速度などのモーション関連情報を提供するために簡単に解釈できる信号を提供する能力により、すべての回転エンコーダーの中で最も広く使用されています。

    回転することにより、回転エンコーダは、制限をカウントすることなく回転ポテンショメータカウンターとは異なり、回転中に出力パルス周波数を正と逆方向にカウントできます。ロータリーエンコーダーのボタンを使用すると、ゼロから始まる初期状態にリセットできます。

  • テストコード

    int redpin = 2;
    int yellowpin = 3;
    int greenpin = 4;
    int apin = 6;
    int bpin = 7;
    int buttonpin = 5;
    int state = 0;
    int longperiod = 5000; //緑または赤での時間
    int shortperiod = 700; //変更時の期間
    int targetcount = shortperiod;
    int count = 0;
    void setup()
    {
      PinMode(Apin、input);
      Pinmode(bpin、input);
      Pinmode(buttonpin、input);
      PinMode(RedPin、出力);
      PinMode(YellowPin、出力);
      PinMode(GreenPin、出力);
    }
    void loop()
    {
      count ++;
      if(digitalread(buttonpin))
      {
      セットライト(高、高、高);
      }
      それ以外
      {
      int change = getEncoderturn();
      int newperiod = longperiod +(変更 * 1000);  
      if(newperiod> = 1000 && newperiod <= 10000)
        {
      longperiod = newperiod;
        }
      if(count> targetCount)
        {
      setState();
      count = 0;
        }
      }
      遅延(1);
    }
    int getEncoderturn()
    {

     // -1、0、または+1を返します
      静的int olda = low;
      static int oldb = low;
      int result = 0;
      int newa = digitalread(apin);
      int newb = digitalread(bpin);
      if(newa!= olda || newb!= oldb)
      {
      //何かが変わった
      if(olda == low && newa == high)
        {
      result = - (oldb * 2-1);
        }
      }
      olda = newa;
      oldb = newb;
      返品結果;
    }
    int setState()
      {
      if(state == 0)
        {
      セットライト(高、低、低);
      TargetCount = longperiod;
      state = 1;
        }
      else if(state == 1)
        {
      セットライト(高、高、低);
      TargetCount = shortperiod;
      state = 2;
        }
      else if(state == 2)
        {
      セットライト(低、低、高);
      TargetCount = longperiod;
      state = 3;
        }
      else if(state == 3)
        {
      セットライト(低、高、低);
      TargetCount = shortperiod;
      state = 0;
        }
      }
    void setlights(int red、int yellow、int green)
    {
      DigitalWrite(Redpin、Red);
      DigitalWrite(イエローピン、イエロー);
      DigitalWrite(GreenPin、Green);

Frequently Bought Together

Total Price: $0.00 USD