Advertisement
smias555

Untitled

May 1st, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <Encoder.h>
  2.  
  3. // Connect your encoder to pins 10 and 12
  4. Encoder knob(10, 12);
  5.  
  6. void setup() {
  7. Serial.begin(9600); // Start serial communication
  8. }
  9.  
  10. void loop() {
  11. long pos = knob.read(); // Get the current position of the encoder
  12. Serial.println(pos); // Print the position to the Serial Monitor
  13. delay(100); // Wait for 100 milliseconds
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement