Emic 2 Random Response

Hi! I am using an Emic 2 Text to speech module and a PIR sensor. When the PIR sensor detects something, I want the Emic 2 to say something. But, heres the catch. I don't want the Emic 2 to say the same thing every time. I want it to say any one of a random response I program. I don't want it to just cycle through a pattern, I want it to choose from a list of responses at random! Is this possible? How could I code this? :slight_smile:

Put all the possible responses in an array and use the random function to get a random number to use as an index to that array to choose one.

https://www.arduino.cc/en/Reference/Random

Don't forget to seed the RNG with something random or you'll get the same sequence of responses every time you reset the board.

Delta_G:
Put all the possible responses in an array and use the random function to get a random number to use as an index to that array to choose one.

https://www.arduino.cc/en/Reference/Random

Don't forget to seed the RNG with something random or you'll get the same sequence of responses every time you reset the board.

Ok, just one question. What do you mean by RNG? I'm new to the Random function!

Also, if you possible could you give me some example code? Thanks for replying to this post!

RNG == Random Number Generator. If you read the link I gave you then you should see the part about seeding it.

If you need help figuring out how to use an array I would suggest a Google search for " c++ arrays"