How to programme an encoder, help needed

  1. last week

    Okay so basically I'm a little bit of a so called 'noob' when it comes to programming. I sound really dumb but how do I programme an encoder, the intent for said encoder is to count how many clicks a gear will take to shoot a ball when building up tension as the idea is to 'slip' and have another object shoot out to hit the ball but I have no idea how to programme this said encoder. Any advice?

  2. mattjiang

    Dec 5 Irvine, CA 2496Y

    for robotC, you can use SensorValue(SensorName) to get a value from the sensor.

  3. gilmorkn472

    Dec 5 Owensboro, Kentucky 97834B

    The encoder counts in degrees, so you might need to figure out how many degrees it turns. Try untilEncoderCounts(degree amount, encoder name)
    and put your code above it and then stop motor after the untilEncoderCounts. Try something like this -

    startMotor(shooter, 65);
    untilEncoderCounts(1280, encoder);
    stopMotor(shooter);

    Just substitute numbers and names in to that code, it should work.

  4. [deleted]

    Dec 6
    Deleted last week by DRow
  5. Deleted last week by DRow
  6. Lukyan_1

    Dec 6 Woodbridge, VA 4303A

    @Kenzie Are you guys using V5?

  7. Joey The Great

    Dec 6 Suspended Maryland 24k

    it shouldn't really matter, aside from that they could use the built in motor encoder instead

 

or Sign Up to reply!