Shop OBEX P1 Docs P2 Docs Learn Events
random movements? — Parallax Forums

random movements?

aznstorminaznstormin Posts: 3
edited 2006-01-03 19:48 in BASIC Stamp
I am doing a project using the boebot, and I am wondering how to make it move randomly - just in general, how to make the bot do random movements. if there is code, where can i get it?

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-12-14 06:17
    Hello,

    · I'm not aware of any RANDOM code, but if you understand how the RANDOM command works you could use it to affect the BOE-Bots direction in one of two ways.· First you could directly randomize the PULSOUT values going to the servo motors.· That would be interesting (the effect).· Another thing is the forward, backup and turn routines could be randomly called, based on a random number.· Just a couple of ideas.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • HiTekGizmosHiTekGizmos Posts: 14
    edited 2006-01-03 18:23
    Maybe you could use a light dependant resistor (CDS cell) and an a/d input to generate a 'random' number based on the light hitting the cell when the test is made... You could design the thing to seek (photovore) or avoid (photophobe) light if you wished...
  • HiTekGizmosHiTekGizmos Posts: 14
    edited 2006-01-03 18:25
    You could run a counter that runs up between bumper hits, the 'random' number would be based on time between collisions...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-01-03 19:48
    One thing to be aware of when running RANDOM stuff with a servo is timing.· You need to be sure your changes don't happen too abruptly or the servo may never reach the position it was heading for when it receives the new changes.· This can cause all kinds of weird symptoms.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.