Random number -> Corresponding LED lit (n00besque content contained)


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Re: Random number -> Corresponding LED lit (n00besque content contained)

    I wonder if someone could explain the
    "MyByte=(MyWord//6)+1" part? // = Remainder (Modulus)? It isn't clear to me what this is doing and how it is extracting the 6 variables.

    I need to randomize 8 LEDs and would like to understand it better.

    Thanks
    Bo

  2. #2
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Random number -> Corresponding LED lit (n00besque content contained)

    If you do the math with a calculator you'll, in my opinion, never understand modulus. Use paper and pencil for some small numbers and you'll see how modulus works.

    I believe to randomize 8 LEDs all you need to do is change the 6 to an 8. Like
    Random myword
    mybyte=(myword//8)

    Depending on how you use mybyte depends on whether or not you need to +1 after myword//8.

    I'm sure someone will chime in and say I've messed up but there you have it.

Members who have read this thread : 0

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