Let's Make Robots!

Basic Atom Programming Help Needed

Ok Basically this is my pseudocode. It's very rough though I did it in around a minute.

main:

start both wheel servos full speed

if object too close in sight move back and move ir sensors left and right to choose direction

if object is blocking left side and not right.. right servo spins backwards and then both servos at full speed

if object is blocking right side and not left... left servo spins backwards then both servos at full speed

if object is blocking both sides... move back and make right servo moves backwards and goto main

 

Right now what I have is this... and it works, but not the way I want it. I want the servo to always be moving.

Main:

    if IN12 = 0 then 

    servo P8, 1500

Endif

goto Main

 

 

Since that last code didn't work to well I tried this code below which didn't do anything.

 Main:

    if IN12 = 0 then

    high P8

Endif

goto Main

 

PS if anyone is wondering what if IN12 = 0 is... it's a button on my bot board. :P 

Can anyone help me find a code to always keep 2 servos continously moving until it detects something? 

  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You write that "it works, but not the way I want it". But you don't tell us what it does. Does it jerk and stop? With every command it gets, or just once until you manually reset it?

From the top of my head:
This servo is designed or modified for continuous rotation, right?
Did you ever have it rotate, continuously? Is it just this code that won't work?

Your second code example will never work on a servo. A servo requires a special kind of pulse. The "high P8" will only feed your servo a flat high voltage. The onboard controller (inside the servo) will not understand it.

The servos move only for a short period of time. The pulsout only lasts very little. I want them to ALWAYS be rotating until they meet an object infront of them. 

"Can anyone help me find a code to always keep 2 servos continously moving until it detects something? " 

Dunno about Basic Atom, I don't have one. If it's available I'd try a while loop. Pseudocode (cause I don't know how to do it right);

while IN12=0

     high P8

 

Or possibly

do

     highP8

while

     IN12=0

 

Whatever the correct syntax is for a Basic Atom. Check the manual for "while".