Questions on random numbers and multiplexing LEDs


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    2

    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
    Location
    So Cal and loving it
    Posts
    40


    Did you find this post helpful? Yes | No

    Default

    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..

    http://www.picbasic.co.uk/forum/showthread.php?t=6601

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

    Good luck,

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

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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