Shop OBEX P1 Docs P2 Docs Learn Events
Halloween - A pair of Curious Eyes in the bushes.... — Parallax Forums

Halloween - A pair of Curious Eyes in the bushes....

Beau SchwabeBeau Schwabe Posts: 6,548
edited 2004-11-04 22:46 in BASIC Stamp
Here is a quickie... Two servo's controlling two sets of LED eyes randomly tilting/pausing/blinking from side to side.
Mount these in the bushes or in a tree where it's dark and hard to see.


On a side note:

Using the RANDOM function I have "seeded" the values so that they would start out differently, but there is no check
to see if the randomized values will eventually synchronize. Aside from checking to see if they are equal and restarting
the program in software, does anyone have a more elegant solution?.... Thus far I have not seen this happen, but I
believe that the potential is there.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 10/13/2007 6:42:32 AM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-31 20:22
    If they start with different seeds, they should stay that way. The RANDOM algorithm should repeat itself until $FFFF interations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Harry StonerHarry Stoner Posts: 54
    edited 2004-11-01 19:19
    Jon, the repetition period of the RNG depends upon the algorithm, and may be much shorter than 64K. I guess the way to test would be to DEBUG or otherwise send the generated values to a PC and then analyse the results.

    I used a RNG recently too. One thing I didn't do but should have, is to occasionally write a value into EEPROM that is read on startup as the new seed value. That would at least ensure a different starting point on subsequent power ups.

    Other ways to introduce entropy to create "fresh" seed values would be to do some permutations on any serial input data received, RTC values if you have one connected, etc. Or I guess if you had an ADC chip with some floating input, you could take a group of readings.
  • Vern GranerVern Graner Posts: 337
    edited 2004-11-03 21:56
    As a way to get a more "random" seed value for the not-so-random "random statement smile.gif I used the RCTIME function to read a value. I did this sinceI noticed that in the BSAC board I used the POT would produce a "jittery" result if sampled and echoed with debug... it would appear that temperature and/or the material in the pot resistance can cause slight variations that can be used to provide a seed. Here's the thread where the code is listed:

    http://forums.parallax.com/showthread.php?p=516970

    Vern
  • Shawn LoweShawn Lowe Posts: 635
    edited 2004-11-04 22:46
    very clever! YOu could also do something like this in a painting or picture. Maybe get the value of a distance sensor to more closely have the eyes follow someone
Sign In or Register to comment.