pulsin then servo + gyro
I've built an RC tank. It has two servos in the turret and the receiver in the hull (bottom). One servo is for gun elevation and one is to turn a laser of and on. Because the turret spins round indefinitely I am using a four contact (VCC, GND, servo1 and servo2) 3.5mm headphone jack, male in the hull, female in the turret. The problem with that was the female section was two big. To solve this I'm now using a 3 contact plug from an iPod (that was already bust) and adding a fourth GND contact but gluing a scalectrics pick-up to the bottom of the jack. This works but isn't very reliable - at certain points in the turret rotation, the GND looses contact and the turret switches off.
What I want to do is have two 08M's; one in the turret and one in the hull.
The one in the hull reads the two pulses coming from the receiver using pulsin and then send them through a normal, 3 contact headphone jack to the 2nd 08M.
This therefore only needs three contacts; VCC, GND and serial.
The 2nd 08M receives the the data and turns the gun elevation data into a servo command and the laser state into a simple on/off.
The problem is: pulsin gives a number between 0-65535 and the servo command requires a position between 0-255.
Can I simply divide the pulsin number by 257 and us that as the servo variable or is it more complicated than that?
Also, once that is working, I want the gun to go up, like on real tanks, so that it doesn't hit the rear hull. How would I do this?
I've built an RC tank. It has two servos in the turret and the receiver in the hull (bottom). One servo is for gun elevation and one is to turn a laser of and on. Because the turret spins round indefinitely I am using a four contact (VCC, GND, servo1 and servo2) 3.5mm headphone jack, male in the hull, female in the turret. The problem with that was the female section was two big. To solve this I'm now using a 3 contact plug from an iPod (that was already bust) and adding a fourth GND contact but gluing a scalectrics pick-up to the bottom of the jack. This works but isn't very reliable - at certain points in the turret rotation, the GND looses contact and the turret switches off.
What I want to do is have two 08M's; one in the turret and one in the hull.
The one in the hull reads the two pulses coming from the receiver using pulsin and then send them through a normal, 3 contact headphone jack to the 2nd 08M.
This therefore only needs three contacts; VCC, GND and serial.
The 2nd 08M receives the the data and turns the gun elevation data into a servo command and the laser state into a simple on/off.
The problem is: pulsin gives a number between 0-65535 and the servo command requires a position between 0-255.
Can I simply divide the pulsin number by 257 and us that as the servo variable or is it more complicated than that?
Also, once that is working, I want the gun to go up, like on real tanks, so that it doesn't hit the rear hull. How would I do this?
Last edited by a moderator: