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?

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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