Reprap Full Graphic Smart Controller jog not working June 05, 2017 06:27PM |
Registered: 9 years ago Posts: 134 |
Re: Reprap Full Graphic Smart Controller jog not working June 05, 2017 06:58PM |
Admin Registered: 13 years ago Posts: 7,108 |
Re: Reprap Full Graphic Smart Controller jog not working June 05, 2017 07:02PM |
Registered: 9 years ago Posts: 134 |
Quote
Dust
Its not a potentiometer (variable resistor)
Its just 2 switches (well 3 if you including the select button)
Known as a Rotary Encoders
See [howtomechatronics.com] for details.
So just turn the knob slowly and check the continuity , it should go on off on off..., check both outputs
Re: Reprap Full Graphic Smart Controller jog not working June 05, 2017 08:09PM |
Admin Registered: 13 years ago Posts: 7,108 |
/* Arduino Rotary Encoder Tutorial * * by Dejan Nedelkovski, www.HowToMechatronics.com * */ #define outputA 35 #define outputB 37 int counter = 0; int aState; int aLastState; void setup() { pinMode (outputA,INPUT); pinMode (outputB,INPUT); Serial.begin (9600); // Reads the initial state of the outputA aLastState = digitalRead(outputA); } void loop() { aState = digitalRead(outputA); // Reads the "current" state of the outputA // If the previous and the current state of the outputA are different, that means a Pulse has occured if (aState != aLastState){ // If the outputB state is different to the outputA state, that means the encoder is rotating clockwise if (digitalRead(output != aState) { counter ++; } else { counter --; } Serial.print("Position: "); Serial.println(counter); } aLastState = aState; // Updates the previous state of the outputA with the current state }
Re: Reprap Full Graphic Smart Controller jog not working June 05, 2017 08:25PM |
Registered: 9 years ago Posts: 134 |
Re: Reprap Full Graphic Smart Controller jog not working June 05, 2017 09:54PM |
Admin Registered: 13 years ago Posts: 7,108 |
Re: Reprap Full Graphic Smart Controller jog not working June 06, 2017 06:10AM |
Registered: 9 years ago Posts: 134 |
Re: Reprap Full Graphic Smart Controller jog not working June 06, 2017 07:22AM |
Admin Registered: 13 years ago Posts: 7,108 |
/* Read Quadrature Encoder * Connect Encoder to Pins encoder0PinA, encoder0PinB, and +5V. * * Sketch by max wolf / www.meso.net * v. 0.1 - very basic functions - mw 20061220 * */ int val; int encoder0PinA = 31; int encoder0PinB = 33; 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; }
/* Button Turns on and off a light emitting diode(LED) connected to digital pin 13, when pressing a pushbutton attached to pin 2. The circuit: * LED attached from pin 13 to ground * pushbutton attached to pin 2 from +5V * 10K resistor attached to pin 2 from ground * Note: on most Arduinos there is already an LED on the board attached to pin 13. created 2005 by DojoDave [www.0j0.org] modified 30 Aug 2011 by Tom Igoe This example code is in the public domain. [www.arduino.cc] */ // constants won't change. They're used here to // set pin numbers: const int buttonPin = 31; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin // variables will change: int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop() { // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } }
Re: Reprap Full Graphic Smart Controller jog not working June 06, 2017 07:52PM |
Registered: 9 years ago Posts: 134 |
Re: Reprap Full Graphic Smart Controller jog not working June 06, 2017 09:05PM |
Admin Registered: 13 years ago Posts: 7,108 |
Re: Reprap Full Graphic Smart Controller jog not working June 06, 2017 09:08PM |
Registered: 9 years ago Posts: 134 |
Re: Reprap Full Graphic Smart Controller jog not working June 06, 2017 09:13PM |
Admin Registered: 13 years ago Posts: 7,108 |
Re: Reprap Full Graphic Smart Controller jog not working June 06, 2017 09:29PM |
Registered: 9 years ago Posts: 134 |
Re: Reprap Full Graphic Smart Controller jog not working June 07, 2017 05:14PM |
Registered: 9 years ago Posts: 134 |