The middle bit.

Help please. Firstly please be kind to me. I am dyslectic and a bit dyscalculic. I am also an old dog learning new tricks. I can learn new stuff if I do it at my own pace.
What I want to do, (using a Flysky FS-16X radio control and reciever) is the following: Using a three position switch I want to turn a Led into one of three states. 1/ Off. 2/ static On. 3/ On flashing a programmed sequence.
So far I have the Arduino recognising that the radio receiver has received the switch state positions of 1, 2 or 3. I have also written the flashing sequence for 3 and static for 2.
What I need is a clue and the correct words I need to search for so I can get the Arduino to carry out 1, 2 and 3.
This is for a combined signal and search lamp on a model boat.
I hope that is clear and thank you in advance for any advise.
Keep well,
John

I assume the different switch positions are encoded as different pulse lengths for that channel?

Is that a valid assumption?

If it is, you could use pulseIn to measure that channel’s pulse, and then take an action based on that length (with a little bit of wobble-room)

Edit: Sorry, re-read it - you’re already there.

Sounds like you're most of the way there. Given the state variable with 1,2 or 3 in it, use a switch statement to choose the behavior for each.

Thank you both for your advice. I have looked at a couple of YouTube vids and I think I have got the hang of what I need to do. The complication is the three states and all the vids have just been 2 states.

My fist bit of the sketch reads the incoming PWM from the RC receiver and gives me three numbers depending on the position of the switch. I will pretend they are 10, 20 and 30.

The middle bit of the sketch, The switch statement, looks at that number and asks are you less than 11? If so turn Led to high. Are you between 15 and 25? If so turn the Led to low. Are you over 25? If so run the Led flasher sequence.

Is that it? It doesn’t appear too complicated.
John

It isn’t difficult, but you have to remember that the flash state (if controlled by software) must use the blink-without-delay approach.

If you have 10, 20, or 30, the cases in the switch statement can reference those exact numbers. If, as seems more likely with R/C, the three way switch gives a different range of values for each position, you might as well use several if statements.