Clean Up for Homework
Notes
- This is just some additional instructions needed to try the homework
-
millis()
- Is a command that returns the number of milliseconds that have passed since the board booted.
- This returns an unsigned long, a 32 bit number.
- You need to be careful with unsigned long computations to make sure that they stay in that range.
- The millisecond timer will overflow in about 50 days.
-
random()
- Takes either a max value or a min and max value
- max and min are longs
- The function returns a long
- The RNG can be seeded with
randomSeed()
- This can be initialized with a digital read of an unused analog pin.
- We need a computation for our experiment, so I did a Monte Carlo π computation.
- Not too difficult to understand
- Can take as much time as you want
- Is easy to stick a button press check in the middle.
- Take a look at the simulation