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

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

      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.

      説明

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

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

      コードのテスト

      int redPin = 2;
      イントイエローピン = 3;
      int グリーンピン = 4;
      int aPin = 6;
      int bPin = 7;
      int ボタンピン = 5;
      int 状態 = 0;
      int longPeriod = 5000;緑または赤での時間
      int shortPeriod = 700;変更する期間
      int ターゲットカウント = 短い期間;
      int カウント = 0;
      無効なセットアップ()
      {
      ピンモード(アピン、入力);
      ピンモード(bPin、入力);
      ピンモード(ボタンピン、入力);
      ピンモード(レッドピン、出力);
      ピンモード(イエローピン、出力);
      ピンモード(グリーンピン、出力);
      }
      ボイドループ()
      {
      カウント++;
      場合 (デジタル読み取り(ボタンピン))
        {
      セットライト(高、高、高)。
        }

        {
      イントチェンジ = getEncoderターン();
      int newPeriod = 長い期間 + (変更 * 1000);
      (新しい期間>= 1000 && 新しい期間<= 10000)
          {
      長い期間 = 新しい期間;
          }
      if (ターゲット数>カウント)
          {
      セットステート()
      カウント = 0;
          }
        }
      遅延(1);
      }
      イント・ゲット・エンコーダーターン()
      {

      戻り値 -1、0、または +1
      静的な int oldA = LOW;
      静的な int 古いB = 低。
      int の結果 = 0;
      int newA = デジタルリード(aPin);
      新しいB = デジタルリード(bPin);
      もし(新しいA!= 古いA||新しいB!= 古いB)
        {
      何かが変わった
      (oldA == 低 && 新しいA == 高)
          {
      結果 = -(oldB * 2 - 1);
          }
        }
      古いA = 新しいA;
      古いB = 新しいB;
      結果を返します。
      }
      イントセットステート()
        {
      if (状態 == 0)
          {
      セットライト(高、低、低)。
      ターゲットカウント = 長い期間;
      状態 = 1;
          }
      else if (状態 == 1)
          {
      セットライト(高、高、低)。
      ターゲットカウント = 短い期間;
      状態 = 2;
          }
      else if (状態 == 2)
          {
      セットライト(低、低、高)。
      ターゲットカウント = 長い期間;
      状態 = 3;
          }
      else if (状態 == 3)
          {
      セットライト(低、高、低)。
      ターゲットカウント = 短い期間;
      状態 = 0;
          }
        }
      ボイドセットライト(イントレッド、イントイエロー、イントグリーン)
      {
      デジタル書き込み(レッドピン、赤)。
      デジタルライト(イエローピン、イエロー);
      デジタルライト(グリーンピン、グリーン);