Mini Robot chassis Encoder SKU:SEN0116
Part | Datasheet |
---|---|
![]() |
SEN0116 (pdf) |
PDF Datasheet Preview |
---|
Mini Robot chassis Encoder SKU:SEN0116 Editing Mini Robot chassis Encoder SKU:SEN0116 Contents • 1 Introduction • 2 Specification • 3 Encoder Connection Diagram Sample Code • 4 FAQ Introduction Specification Encoder Connection Diagram Mini robot encoder diagram Sample Code const byte encoder0pinA = 2;//A pin -> the interrupt pin 0 const byte encoder0pinB = 4;//B pin -> the digital pin 4 byte encoder0PinALast int duration;//the number of the pulses boolean Direction;//the rotation direction void setup Serial.begin 57600 ;//Initialize the serial port EncoderInit ;//Initialize the module void loop Serial.print "Pulse:" Serial.println duration = 0 delay 100 ; void EncoderInit Direction = true;//default -> Forward pinMode encoder0pinB,INPUT attachInterrupt 0, wheelSpeed, CHANGE ; void wheelSpeed int Lstate = digitalRead encoder0pinA if encoder0PinALast == LOW && Lstate==HIGH int val = digitalRead encoder0pinB if val == LOW && Direction Direction = false //Reverse else if val == HIGH && !Direction Direction = true //Forward encoder0PinALast = Lstate if !Direction duration++ else duration--; Q1. I have a question about the encoder. In the process of adjusting the screws, I have turned a screw out of range and don't know which way to turn it back. Is there one direction i should turn it to 'start from zero'? Powered By DFRobot 2008-2017 |
More datasheets: AD5547BRU-REEL7 | CY2292F | 6003-410-008 | 48-213/T7D-BQ1R2QY/3C | S3444-O-M | HMT25E-F4-SS-7X5-A1-CW-SM18-S | 2322 662 93114 | 2322 661 91066 | 2322 662 93074 | 2322 662 93129 |
Notice: we do not provide any warranties that information, datasheets, application notes, circuit diagrams, or software stored on this website are up-to-date or error free. The archived SEN0116 Datasheet file may be downloaded here without warranties.