Questions on random numbers and multiplexing LEDs

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009

    Default Questions on random numbers and multiplexing LEDs

    I have two quesions about coding.

    My first question is in relation to random number generation, I understand RANDOM val will produce a value between 1 and 65535. Is there some way of directly requesting a value in a set range, say between 12 and 20? Or do I need to perform some mathematical algorithim to reduce val back to the range I want?

    Also I am not entirely new to PICs, but what I have not needed to do anything this complex with them before. A friend of mine is into architeture and wants me to create an RGB LED array that will wrap around one of his model buildings. His wishlist (subject to what I can do) includes the display producing a mixture of random colours, ordered patterns and scrolling text.

    I was thinking of using a MAX6952 to drive the LEDs, this device includes the basic fonts, or creating the fonts directly based on the PIC's ports. The question is I know I can make the PIC display text but how to I increment the text's postion on the display to make it appear to scroll around the building?

    Thankyou in advance to anyone who can provide me with some help on these questions.

  2. #2
    Join Date
    Dec 2005
    So Cal and loving it

    Did you find this post helpful? Yes | No


    Welcome to he forum.

    Question 1:
    Something like

    random randomnum1
    dice1num = (randomnum1//6)+1

    Question 2:
    More than I have done with LEDs but try this post to get going..

    Sounds like fun - post some pics or a vid if you pull it off.

    Good luck,

    | PBP 2.47/2.50 | MCS+ | U2 Prog | Vista x64 | NO SLEEP!!!!!!! |

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts