Author Topic: My putting ball return code  (Read 950 times)

0 Members and 1 Guest are viewing this topic.

Offline Joker94Topic starter

  • Supreme Robot
  • *****
  • Posts: 1,119
  • Helpful? 26
My putting ball return code
« on: February 12, 2010, 05:02:02 PM »
Hi every one

I am finally getting around to writing my code for my putting ball return. What i want to happen is the servo start when it senses the light has been blocked as at the moment it starts straight away.

What i want my code to do it this. when the sensor senses thee light is blocked the servo starts, lift the platform to a certain hight, stop at that hight and weight for a specified delay and lower the platform back down.

i might have to add an extra sensor/push button in to stop the servo at a specific hight and again when it is completely lowered as it is a modified servo and has no encoders.

I will be writing my code in C not Arduino.

thanks for everyones help

Joker94

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: My putting ball return code
« Reply #1 on: February 12, 2010, 11:44:43 PM »
are you asking for help in writing the code?

This project seems simple, almost too simple to be using a micro-controller to run. You could use a few logic gates and a 555 timer to drive the servo and achieve the same result.

Offline Joker94Topic starter

  • Supreme Robot
  • *****
  • Posts: 1,119
  • Helpful? 26
Re: My putting ball return code
« Reply #2 on: February 14, 2010, 03:27:15 AM »
i know it is simple at the moment but i plan to add sensors to sense the speed of the ball and later have a computer program return a simulation but at the moment i just want the sensor to run a simple program.

step of the program:
1.start with the servo off
2. when the sensor goes under threshold i want the platform to lift up
3.wait for a delay
4.return to the original position(i know i will have to add a sensor as i dont have encoders
5.return to step1.

the sensor is a LDR with a LED on the opposite side which will be bloked  by the golf ball.

i dont need help writing the program as i want this to be a learning experience. i just dont want the servo to start up when the power is applyed and before the sensor is activated.

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: My putting ball return code
« Reply #3 on: February 14, 2010, 07:47:28 AM »
Well, I guess you will have 2 positions for your servo, a position for the platform down and a position for the platform up. Let's assume the first position is the servo arm at 0 degrees and the second position is the servos arm at 90 degrees. When you apply power to the servos and electronics, the servo will jolt until a signal will tell it to go to the first position. So, when you set the servo active, before you enter the main code, write the first servo position to the servo. That will make the platform go to the Down position. If you use a hardware PWM signal, the servo will keep that position until you tell it to go to another position or you take the power off, or deactivate the servo (WebbotLib will do just that).

To keep the servo from moving when power is applied, you will need to apply the signal first, then turn ON the servo power. You can do that if you use a relay to apply the power to the servo, or by having separate power supplies for servos and electronics and switch the electronics power ON first, then the servo power.
Check out the uBotino robot controller!

 


Get Your Ad Here