Activity › Forums › Questions & Troubleshooting › Software & Firmware › Random seed using analogread
-
Random seed using analogread
-
Hi, I’m trying to initiate the random generator using the analogread from one unconnected pin as I’ve read in many forum.
Unfortunately the analogread always returns 0, I’ve tryed from A0 to A9 and CONTROLLINO_A0 to CONTROLLINO_A9.
Do you have some ideas?
Is there any other good way to initiate the random generator?
Thanks.
Daniele.
(Board: Controllino Maxy pure)
-
Hello Daniele, All analog pins are tied to Ground from the voltage divider.
So you cannot create a random number with that method.
regards
Marco
-
Thanks Marco, now the 0 get sense. Do you know any other method I can use to initialize the seed?
(I’ve got no user interaction so I cannot use millis).
Daniele.
-
Hi, I’ve get good results using the
library. Thanks to all!
Log in to reply.