In SX Microcontrollers, SX/B Compiler and SX-Key Tool, tgsimmons wrote: Hi All, I'm building a Halloween prop that will be a large jack-in-the-box. The user will turn a crank on the side of the box that will send pulses to the SX which will trigger the play back, individually, of the 30 notes in the jack-in-the-box song from a ChipCorder. For scare value, instead of popping the "jack" up at the usual place in the song, I'd like to do it randomly. What I'm thinking I'd like to do at the start of each sequence is generate a "random" integer between 5-30 (starting at 5 notes into the song so they think it's a normal jack-in-the-box), the SX would then count the pulses from the crank and when it got to this "random" number, trigger the "jack" to pop-up. What I don't know how to do is to generate this integer between 5 and 30. I've looked at the RANDOM command in SX/B and somewhat understand it, I just don't know how I'd get the result to be an integer between 5 and 30. Any suggestions? This will be my first real SX project so I'm at the beginner level in using SX/B. If anyone has a better way to do this, I'm open for ideas. Thanks. Terry ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=193221 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)