Servo motor random pattern question

Hi, Im a beginner and i've just started coming to grips with programming servo motors with the arduino.

As a first project I'm looking to make a pop up gun target with 3 separate motors. The idea is that the 3 servos are attached to a pole each with a target at the end. I want them to pop up 90 degrees at (semi) random intervals of between 10-20 seconds. Hold upright for a few seconds to be fired at then return to the rest phase again. However ideally I'd like them to pop up in random patterns of either one or two targets at a time (*meaning there are 6 possible combinations of target configurations) *I.e. left target up, middle target down, right target up all at the same time etc. etc.

I can figure out the basics as to how to get the servos to pop up 90 degrees using the "random" function "random(10000, 20000)". But my tiny brain struggles with how to get them to pop up randomly in one of the afforementioned 6 different available patterns each time round. Any advice on how to do this would be greatly appreciated. Thanks in advance!

I can figure out the basics as to how to get the servos to pop up 90 degrees using the "random" function "random(10000, 20000)".

I'd love to see how that works...

Look at the bits in random(1,7) .... :slight_smile:

001
010
011
100
101
110

LOL

Thanks for the reply aarg, could you possibly explain that previous post in simpler terms? I'd appreciate that. Thanks

JabbaCool84:
Thanks for the reply aarg, could you possibly explain that previous post in simpler terms? I'd appreciate that. Thanks

001
010
011
100
101
110

aka
1
2
3
4
5
6
In binary.

There are 6 patterns of targets that pop up . I think that the ones are targets that will pop up and zeros stay down. So you would generate 2 random numbers. A time to pop up targets and the pattern of targets to pop up.

groundFungus:
There are 6 patterns of targets that pop up and zeros stay down. I think that the ones are targets that will pop up. So you would generate 2 random numbers. A time to pop up targets and the pattern of targets to pop up.

Many thanks for clarifying that groundFungus! That makes much more sense, I'll give that a go