Shop OBEX P1 Docs P2 Docs Learn Events
experiment 9 — Parallax Forums

experiment 9

aleshalesh Posts: 1
edited 2005-06-20 13:35 in Learn with BlocklyProp
i am doing experiment 9 which is the digital die. i have completed it but now i want to put two dice on it. how do i make the two dice show·different numbers. because right now i have two dice working but they always show the same numbers what should i change to make them show different random numbers?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-20 13:35
    If you want to light two of the 7-segment displays on the NX-1000 (or PDB) then you must multiplex them -- StampWorks experiment 10 shows how.· To get random values for the dice, simply tumble the RANDOM function until a button is pressed.· To get the values for a set of dice you could do this:

    · die1 = rndVal.BYTE0 // 6 + 1
    · die2 = rndVal.BYTE1 // 6 + 1

    The variable rndVal is a Word that is mixed up by the RANDOM function.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.