RobotDyn Rotary Encoder Module

Marca RobotDyn, produce prodotti di alta qualità con impareggiabile rapporto qualità-prezzo.

€2.99
Tax included *
11 items
Quantity

 

100% confiance. Vos achats et données sont totalement sécurisés.

 

Envoi le jour même si commande validé avant 11h30.

 

Politique retours 14 jours.

The rotary encoder module is an angular measuring device. It is used to precisely measure the 24-steps rotation of knob that can turn infinitely (with no end stop like a potentiometer has). The rotary encoder module also has a pushbutton when you press on the axis (like the ones used for navigation on many music controllers).

Arduino sketch:

int val; 
int encoder0PinA = 3; 
int encoder0PinB = 4; 
int encoder0Pos = 0; 
int encoder0PinALast = LOW; 
int n = LOW; 

void setup() 
{ 

pinMode (encoder0PinA,INPUT);
pinMode (encoder0PinB,INPUT);
Serial.begin (9600);

} 

void loop() 
{ 
n = digitalRead(encoder0PinA); 
if ((encoder0PinALast == LOW) && (n == HIGH)) { 

if (digitalRead(encoder0PinB) == LOW)

{ 

  encoder0Pos--; 

  } 
  else { 
        encoder0Pos++; 
  } 
Serial.print (encoder0Pos); 
Serial.print ("/"); 
} 
encoder0PinALast = n; 
}

1468MB
11 Items

4 other products in the same category: