Activity Forums Questions & Troubleshooting Software & Firmware Random seed using analogread

  • Random seed using analogread

  • d-serafini

    Member
    January 28, 2019 at 9:22 am

    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)

  • mr-controllino

    Administrator
    January 28, 2019 at 3:42 pm

    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

  • d-serafini

    Member
    January 28, 2019 at 4:22 pm

    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.

  • d-serafini

    Member
    January 29, 2019 at 9:06 am

    Hi,

    I’ve get good results using the library.

    Thanks to all!

Viewing 1 - 4 of 4 replies

Log in to reply.

Original Post
0 of 0 posts June 2018
Now