EasyManuals Logo

Arduino uno User Manual

Arduino uno
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #67 background imageLoading...
Page #67 background image
Generating Random Numbers
Some computing problems are surprisingly difficult, and creating good random
numbers is one of them. After all, one of the most important properties of a computer
is deterministic behavior. Still, we often needat least seeminglyrandom behavior
for a variety of purposes, ranging from games to cryptographic algorithms.
The most popular approach (used in Arduinos
random()
function) is to create pseudo-
random numbers.
a
They seem to be random, but they actually are the result of a
formula. Different kinds of algorithms exist, but usually each new pseudorandom
number is calculated from its predecessors. This implies that you need an initialization
value to create the first random number of the sequence. This initialization value is
called a random seed, and to create different sequences of pseudorandom numbers,
you have to use different random seeds.
Creating pseudorandom numbers is cheap, but if you know the algorithm and the
random seed, you can easily predict them. So, you shouldnt use them for crypto-
graphic purposes.
In the real world, you can find countless random processes, and with the Arduino,
its easy to measure them to create real random numbers. Often its sufficient to read
some random noise from analog pin 0 and pass it as the random seed to the
random-
Seed()
function. You can also use this noise to create real random numbers; there is
even a library for that purpose.
b
If you need strong random numbers, the Arduino is a perfect device for creating them.
You can find many projects that observe natural processes solely to create random
numbers. One of them watches an hourglass using the Arduino.
c
a.
http://en.wikipedia.org/wiki/Pseudo-random_numbers
b.
http://code.google.com/p/tinkerit/wiki/TrueRandom
c.
http://www.circuitlake.com/usb-hourglass-sand-timer.html
Working with Buttons
In this section youll learn how pushbuttons work in principle and how you
can use them with an Arduino. Well start small and build a circuit that uses
a pushbutton to control a single LED.
What exactly is a pushbutton? The following figure shows three views of a
typical pushbutton. It has four connectors that fit perfectly on a breadboard
(at least after you have straightened them with a pair of pliers). Two opposite
pins connect when the button is pushed; otherwise, they are disconnected.
Chapter 3. Building Binary Dice 48
report erratum discuss
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino uno and is the answer not in the manual?

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals