My stepfather asked me to try to fix an old RC car he was given. The existing board in the car has a few fried components that I can’t identify so I can’t just replace them.
Therefore, I thought I could use this as a good learning experience. I have already sorted out the RC part. I’m using Sparkfun’s 433 MHz RX/TX modules and the VirtualWire library together with a Wii nunchuck. That part works a treat together with the receiving code I threw together.
My problem concerns how to steer the thing! I opened up the vehicle and found the steering is controlled by a dc motor which is connected to a pot via some gears and through that to the steering linkages (I think that’s the correct term). I’ve already established that I can read the pot separately via an analog pin and I’m currently using a SN754410 chip to control the speed and direction of the motor (ignoring the pot for now).
Can someone point to me to some sample code that could help get me started ? I figured I’d need to read the pot first, somehow convert that (possibly using map) to a value that can match the steering command I receive via the remote and see if I need to move the motor, and, if so, how fast should the motor move, i.e. was it an abrupt change, like yanking the steering, or a gentle turn (I’ll already know the direction from the TX). Commands from the TX will be in the format R0 (steer straight), R12 (steer Right 12), L45 (steer left 45). I figured I’d try to use the numbers as degrees to turn.
Any help, pointers or just ‘Hey that won’t work because …’ gratefully accepted