1

I've built a steering wheel that checks the servomotor position using NXC function - MotorRotationCount(). Now, I want to send that position to second brick using Bluetooth and apply that servomotor position to another servomotor controlling the car's steering. I've figured out how to send the data between bricks but I can't find a way to mirror that servomotor position. Is it possible?

1 Answer 1

0

Yes it's definitely possible. See the motor functions here. I would try the following:

  1. Receive the controller's position over bluetooth.
  2. Use MotorTachoCount (byte output) to get the position of the steering motor.
  3. Compare controller's position to the steering motor's position.

    if(controller > steering) drive steering forward. else drive steering backward.

  4. Repeat 1-4.

There are a few enhancements you can make as well, once you get this working. For one, it may help to set the steering motor's power proportional to the difference between the positions. For example, pwr = 0.5*abs(controller - steering) . Adjust the 0.5 by trial and error until the steering is responsive, but not over-responsive. This will make the steering faster if the difference is large, and slower when the difference is small. It may also be worth looking into the motor PID functions to make the steering even smoother.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.