1PCS KY-040 Rotary Encoder Module Brick Sensor Development For Arduino

New product

284.00 ₹ tax excl.

Add to wishlist

PayU Payment Gateway
PayU Payment Gateway

More info

XD-88 360' Encoder


Description

Arduino rotary encoder module KY-040 

Operating voltage: 5V 

Circle pulses: 20 

Download Address: http: //www.kuaipan.cn/file/id_235696277512257652.htm 

By rotating the rotary encoder can count forward and backward direction of rotation of the output pulse frequency during rotation count unlike potentiometers, this rotation count is not limited. With the button on the rotary encoder can be reset to the initial state, that is, from 0 to start counting. 

How it works: 

The incremental encoder is a rotational displacement signal is converted to a series of digital pulse rotary sensor. These pulses are used to control the angular displacement. In Eltra encoder angular displacement conversion using the photoelectric scanning principle. Reading system to rotate the radial indexing plate (code disk) consists of alternating opaque and translucent window windows constitute the basis, while the vertical irradiation is an infrared light source, an optical encoder of the image projected onto the surface of the receiver . The receiver is covered with a diffraction grating, which has the same width of the window the code wheel. The receiver's job is to feel the changes produced by rotating the disc, and then convert the light into corresponding electrical changes vary. Then make a low level signal rises to a higher level, and produce without any interference of square pulses, which must be processed by the electronic circuit. Reading systems typically employ a differential mode, the same waveform is about two different signals out of phase by 180 ° compared in order to improve the quality and stability of the output signal. The difference between the two readings is then formed on the basis of the signal, thereby eliminating the interference. 

Incremental encoder: 

Incremental encoders are given two-phase square wave, their phase 90 °, commonly referred to as A and B channels. Wherein a channel is given information related to the rotation speed, at the same time, the two channel signals by comparing sequence information obtained in the rotation direction. There is also a special signal called Z or zero channel that gives absolute encoder is zero, this signal is coincident with the center line of a square wave A square wave channel.

Incremental encoder accuracy depends on the mechanical and electrical two factors, which include: raster indexing error, eccentric disc, eccentric bearing, electronic reading device errors and inaccuracies introduced by the optical parts. OK encoder resolution is measured in degrees, encoder resolution determines the electrical pulses produced by the encoder division. The following electrical degrees with 360 ° rotation of the mechanical axis is represented, and the rotation axis must be a complete cycle. To know how much mechanical angle corresponds to 360 degrees electrically, you can use the following formula: electrical machinery 360 = 360 ° / n ° pulses / revolution   

Figure: A, B commutation signal 

Encoder indexing error is maximum offset electrical angle of two units to represent the continuous pulse. Any error exists in an encoder, which is caused by the aforementioned factors. Eltra encoder maximum error is ± 25 electrical degrees (in any condition is declared), equivalent to nominal offset ± 7%, as for the maximum deviation of the phase difference 90 ° (electrically) two channels is ± 35 Electrical rating equivalent degree offset ± 10%. 

UVW incremental encoder signals 

In addition to the conventional encoders, there are some integration with other electrical output signal with the incremental encoder. Integrated with UVW incremental encoder signal is an instance, it is usually applied to the AC servo motor feedback. These magnetic signals generally appear in the AC servo motor, UVW signal usually through an analog magnetic original features and design. In Eltra encoder UVW signals which are generated by an optical method, and in the form of three square waves, offset each other 120 °. In order to facilitate the motor starts, the starter motor is controlled by these signals need to correct. These UVW poles pulses repeated many times in the mechanical shaft rotation, because they directly depend on the number of motor poles are connected, and for 4,6 or more signals UVW pole motor. ************************************************** ************************* 

ARDUINO test code:


int redPin = 2;


int yellowPin = 3;


int greenPin = 4;


int aPin = 6;


int bPin = 7;


int buttonPin = 5;


 


int state = 0;


int longPeriod = 5000; // Time at green or red


int shortPeriod = 700; // Time period when changing


int targetCount = shortPeriod;


int count = 0;


 


void setup ()


{


  pinMode (aPin, INPUT);


  pinMode (bPin, INPUT);


  pinMode (buttonPin, INPUT);


  pinMode (redPin, OUTPUT);


  pinMode (yellowPin, OUTPUT);


  pinMode (greenPin, OUTPUT);


}


 


void loop ()


{


  count ++;


  if (digitalRead (buttonPin))


  {


    setLights (HIGH, HIGH, HIGH);


  }


  else


  {


    int change = getEncoderTurn ();


    int newPeriod = longPeriod + (change * 1000);


    if (newPeriod> = 1000 && newPeriod <= 10000)


    {


      longPeriod = newPeriod;


    }


    if (count> targetCount)


    {


      setState ();


      count = 0;


    }


  }


  delay (1);


}


 


int getEncoderTurn ()


{


  // Return -1, 0, or +1


  static int oldA = LOW;


  static int oldB = LOW;


  int result = 0;


  int newA = digitalRead (aPin);


  int newB = digitalRead (bPin);


  if (newA! = oldA || newB! = oldB)


  {


    // Something has changed


    if (oldA == LOW && newA == HIGH)


    {


      result = - (oldB * 2 - 1);


    }


  }


  oldA = newA;


  oldB = newB;


  return result;


}


 


int setState ()


  {


    if (state == 0)


    {


      setLights (HIGH, LOW, LOW);


      targetCount = longPeriod;


      state = 1;


    }


    else if (state == 1)


    {


      setLights (HIGH, HIGH, LOW);


      targetCount = shortPeriod;


      state = 2;


    }


    else if (state == 2)


    {


      setLights (LOW, LOW, HIGH);


      targetCount = longPeriod;


      state = 3;


    }


    else if (state == 3)


    {


      setLights (LOW, HIGH, LOW);


      targetCount = shortPeriod;


      state = 0;


    }


  }


 


void setLights (int red, int yellow, int green)


{


  digitalWrite (redPin, red);


  digitalWrite (yellowPin, yellow);


  digitalWrite (greenPin, green);


}

Package Info

1 X Pc Rotary Encoder

Feedback Info

We Provide Optimum Quality and Fast Shipping which is self explanatory by Review others have given us please have look if you have any question of doubt. Our Prices are the Cheapest on E-bay, If you find any of our item Selling at cheaper price then Message us the details and we would provide you at same price. For providing such services many individuals and department of ours are working very hard 24hr X 7 X 365 days, and we look for token of appreciation for all this by providing us with positive feedback.


For Any Technical Assistance and Guidance Please Post on Our Forum www.sonishop.com/forum We would get back to you for same.

Reviews

Write a review

1PCS KY-040 Rotary Encoder Module Brick Sensor Development For Arduino

1PCS KY-040 Rotary Encoder Module Brick Sensor Development For Arduino

1PCS KY-040 Rotary Encoder Module Brick Sensor Development For Arduino <div><h2 class="header" style="color:rgb(255,208,60);font-family:sans-serif;background-color:rgb(255,255,255);">XD-88 360' Encoder</h2><h2 class="header" style="color:rgb(255,208,60);font-family:sans-serif;background-color:rgb(255,255,255);"><br style="color:rgb(0,0,0);font-family:Times;font-weight:normal;" /></h2><h2 class="header" style="color:rgb(255,208,60);font-family:sans-serif;background-color:rgb(255,255,255);">Description</h2><h2 class="header" style="font-family:sans-serif;background-color:rgb(255,255,255);"></h2><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Arduino rotary encoder module KY-040 </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Operating voltage: 5V </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Circle pulses: 20 </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Download Address: http: //www.kuaipan.cn/file/id_235696277512257652.htm </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">By rotating the rotary encoder can count forward and backward direction of rotation of the output pulse frequency during rotation count unlike potentiometers, this rotation count is not limited. With the button on the rotary encoder can be reset to the initial state, that is, from 0 to start counting. </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">How it works: </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">The incremental encoder is a rotational displacement signal is converted to a series of digital pulse rotary sensor. These pulses are used to control the angular displacement. In Eltra encoder angular displacement conversion using the photoelectric scanning principle. Reading system to rotate the radial indexing plate (code disk) consists of alternating opaque and translucent window windows constitute the basis, while the vertical irradiation is an infrared light source, an optical encoder of the image projected onto the surface of the receiver . The receiver is covered with a diffraction grating, which has the same width of the window the code wheel. The receiver's job is to feel the changes produced by rotating the disc, and then convert the light into corresponding electrical changes vary. Then make a low level signal rises to a higher level, and produce without any interference of square pulses, which must be processed by the electronic circuit. Reading systems typically employ a differential mode, the same waveform is about two different signals out of phase by 180 ° compared in order to improve the quality and stability of the output signal. The difference between the two readings is then formed on the basis of the signal, thereby eliminating the interference. </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Incremental encoder: </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Incremental encoders are given two-phase square wave, their phase 90 °, commonly referred to as A and B channels. Wherein a channel is given information related to the rotation speed, at the same time, the two channel signals by comparing sequence information obtained in the rotation direction. There is also a special signal called Z or zero channel that gives absolute encoder is zero, this signal is coincident with the center line of a square wave A square wave channel.</p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Incremental encoder accuracy depends on the mechanical and electrical two factors, which include: raster indexing error, eccentric disc, eccentric bearing, electronic reading device errors and inaccuracies introduced by the optical parts. OK encoder resolution is measured in degrees, encoder resolution determines the electrical pulses produced by the encoder division. The following electrical degrees with 360 ° rotation of the mechanical axis is represented, and the rotation axis must be a complete cycle. To know how much mechanical angle corresponds to 360 degrees electrically, you can use the following formula: electrical machinery 360 = 360 ° / n ° pulses / revolution   </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Figure: A, B commutation signal </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">Encoder indexing error is maximum offset electrical angle of two units to represent the continuous pulse. Any error exists in an encoder, which is caused by the aforementioned factors. Eltra encoder maximum error is ± 25 electrical degrees (in any condition is declared), equivalent to nominal offset ± 7%, as for the maximum deviation of the phase difference 90 ° (electrically) two channels is ± 35 Electrical rating equivalent degree offset ± 10%. </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">UVW incremental encoder signals </p><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">In addition to the conventional encoders, there are some integration with other electrical output signal with the incremental encoder. Integrated with UVW incremental encoder signal is an instance, it is usually applied to the AC servo motor feedback. These magnetic signals generally appear in the AC servo motor, UVW signal usually through an analog magnetic original features and design. In Eltra encoder UVW signals which are generated by an optical method, and in the form of three square waves, offset each other 120 °. In order to facilitate the motor starts, the starter motor is controlled by these signals need to correct. These UVW poles pulses repeated many times in the mechanical shaft rotation, because they directly depend on the number of motor poles are connected, and for 4,6 or more signals UVW pole motor. ************************************************** ************************* </p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">ARDUINO test code:</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int redPin = 2;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int yellowPin = 3;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int greenPin = 4;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int aPin = 6;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int bPin = 7;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int buttonPin = 5;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"> </font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int state = 0;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int longPeriod = 5000; // Time at green or red</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int shortPeriod = 700; // Time period when changing</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int targetCount = shortPeriod;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int count = 0;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"> </font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">void setup ()</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">{</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  pinMode (aPin, INPUT);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  pinMode (bPin, INPUT);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  pinMode (buttonPin, INPUT);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  pinMode (redPin, OUTPUT);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  pinMode (yellowPin, OUTPUT);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  pinMode (greenPin, OUTPUT);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">}</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"> </font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">void loop ()</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">{</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  count ++;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  if (digitalRead (buttonPin))</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    setLights (HIGH, HIGH, HIGH);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  else</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    int change = getEncoderTurn ();</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    int newPeriod = longPeriod + (change * 1000);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    if (newPeriod&gt; = 1000 &amp;&amp; newPeriod &lt;= 10000)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      longPeriod = newPeriod;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    if (count&gt; targetCount)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      setState ();</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      count = 0;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  delay (1);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">}</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"> </font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int getEncoderTurn ()</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">{</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  // Return -1, 0, or +1</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  static int oldA = LOW;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  static int oldB = LOW;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  int result = 0;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  int newA = digitalRead (aPin);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  int newB = digitalRead (bPin);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  if (newA! = oldA || newB! = oldB)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    // Something has changed</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    if (oldA == LOW &amp;&amp; newA == HIGH)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      result = - (oldB * 2 - 1);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  oldA = newA;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  oldB = newB;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  return result;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">}</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"> </font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">int setState ()</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    if (state == 0)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      setLights (HIGH, LOW, LOW);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      targetCount = longPeriod;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      state = 1;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    else if (state == 1)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      setLights (HIGH, HIGH, LOW);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      targetCount = shortPeriod;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      state = 2;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    else if (state == 2)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      setLights (LOW, LOW, HIGH);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      targetCount = longPeriod;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      state = 3;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    else if (state == 3)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    {</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      setLights (LOW, HIGH, LOW);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      targetCount = shortPeriod;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">      state = 0;</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">    }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  }</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"> </font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">void setLights (int red, int yellow, int green)</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">{</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  digitalWrite (redPin, red);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  digitalWrite (yellowPin, yellow);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">  digitalWrite (greenPin, green);</font></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4"><br /></font></p><p style="font-family:Times;font-weight:normal;"></p><p style="margin:0px;font-weight:normal;font-family:Arial;"><font size="4">}</font></p><h2 class="header" style="color:rgb(255,208,60);font-family:sans-serif;background-color:rgb(255,255,255);">Package Info</h2><h2 class="header" style="color:rgb(255,208,60);font-family:sans-serif;background-color:rgb(255,255,255);"></h2><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">1 X Pc Rotary Encoder</p><h2 class="header" style="color:rgb(255,208,60);font-family:sans-serif;background-color:rgb(255,255,255);">Feedback Info</h2><h2 class="header" style="color:rgb(255,208,60);font-family:sans-serif;background-color:rgb(255,255,255);"></h2><p style="color:rgb(0,0,0);font-family:Times;font-weight:normal;">We Provide Optimum Quality and Fast Shipping which is self explanatory by Review others have given us please have look if you have any question of doubt. Our Prices are the Cheapest on E-bay, If you find any of our item Selling at cheaper price then Message us the details and we would provide you at same price. For providing such services many individuals and department of ours are working very hard <b>24hr X 7 X 365 days</b>, and we look for token of appreciation for all this by providing us with positive feedback.</p></div><center></center><!-- VENDBASCTCTCTVENDBASCT --> <br /><font size="5">For Any Technical Assistance and Guidance Please Post on Our Forum <font color="#5566dd">www.sonishop.com/forum </font><font color="#333333">We would get back to you for same.</font></font><div><font size="5"><font color="#333333"><br /></font></font></div>
284.00 ₹

8 other products in the same category: