Hello. Im working on Beam and Ball Project, and in this project I want to measure ball distance (with HC SR04) and beam angle (with encoder). How to program it for measuring angle ? Also , Which sensors do you advise me instead of them. Thanks
Structure is like in this video : Ball and Beam - YouTube

every step of the encoder is some angle.
E.g. a encoder that has 200 steps per rotation has 360/200 degrees per step = 1.8 degree.
so you must count the steps clockwise and counterclockwise to know the number of steps from a reference position. Then multiply that by 1.8 and you got your angle.
[does this make sense?]
Moderator mode: cross post deleted