I'm getting close to finishing my air raid siren ( see attached photo's ) I've written some code to alter the siren speed depending the position of a rotary switch, this took me a while using the arduino cook book, Jeremy Blum vids on youtube and here searching the forums.

My setup is RC motor and controller with BEC, 7.2v 3700mah battery, arduino uno, 6 position rotary switch with voltage divider circuit to sense position, main power on / off switch, on order two led push buttons.

I've got the siren running on this set up but would like to add 2 NO push buttons in series to start the siren. this is a safety feature to ensure both hands are on the buttons when running. ( and not in the chopper )

The first three positions on the rotary switch will be low speed cycles for indoor use for me and my kid to use. the remaining three postion will be full speed simulating WWII air raid, and fire trucks but I don't want the little guy hurting his ears so I was thinking of creating a pushing pattern to enable the high speed cycles. something like 5 short presses on the push buttons.

This is where i need some help in formating the right code into my program. my thoughts are sense the button being pressed add 1 to variable each time it's pressed then i need to add this to my else if statements but I not sure of the correct formatting.

Any help would gratefully recieved, please go gently on my code as this is the 1st arduino program I've written, I'm sure it could be more efficient, but the only other thing I've programmed is a 1970's Casio calculator for trigonometry.

The value used by servo.write() is an integer which moves normal servos to the angle defined by the number or it sets the speed for continuous rotation servos. I cannot begin to imagine what it does with (pos = 13) etc.

As an aside, a continuous rotation servo is not a servo at all as far as I am concerned, but that battle was lost some time ago.

Please do not send me PMs asking for help. Post in the forum then everyone will benefit from seeing the questions and answers.

I am happy with my motor control, it runs, I can controller it's rise and fall with great precision. John thanks you have been most helpfull and have explained the best way to write my else if statements I did pre check the analog values before doing my else if statements 168/339/509/680/852/1023.