I wanted to make an LED come on with RC PWM signal and stay on

How to replace the press button to a RC PWM signal EX:

if(ch1>1000){digitalWrite(11, HIGH);}
if(ch1<1600){digitalWrite(11, LOW);}
if(ch1<1600){digitalWrite(13, HIGH);}
if(ch1>1000){digitalWrite(13, LOW);}

In the program below

I wanted to make an LED come on when you press a button and stay on, then once you press the button again it goes off and stays off until you press the button again.

//Radio Buttons 22

const int redledPin = 11; //LED Pin #
const int greenledPin = 13;
const int redbutton = 2; //button Pin #
const int greenbutton = 3;

char redbuttonstate = 0;
char greenbuttonstate = 0;

unsigned long redbuttoncount = 0; //button debounce timer
unsigned long greenbuttoncount = 0;

//"marker" chooses which counter to check
// by Paul___B of Arduino Forum

boolean timeout(unsigned long *marker, unsigned long interval) {
if (millis() - *marker >= interval) {
*marker += interval; //move on ready for next interval
return true;
}
else return false;
}

//Deal with a button read; true if button pressed and debounce is a new event
//Uses reading of button input, debounce store, state store and debounce interval.
//by Paul___B of Arduino Forum
boolean buttondown(char button, unsigned long *marker, char *buttonstate, unsigned long interval) {
switch (*buttonstate) { //odd states if was presses, >= 2 if debounce in progress
case 0: //button up so far,
if (button == HIGH) return false; //nothing happening!
else {
*buttonstate = 2; // record that is now pressed
*marker = millis(); // note when was pressed
return false; //and move on
}

case 1: //button down so far,
if (button == LOW) return false; // noting happening!
*buttonstate = 3; //record that is now released
*marker = millis(); //note when was released
return false; // and move on

case 2: //button was up, now down.
if (button == HIGH) {
*buttonstate = 0; // jackpot! update the state
return true; //because we have the desired event!
}
else
return false; //not done yet; just move on

case 3: // button was down mow up
if (button == LOW) {
*buttonstate = 1; //no, not debounced; revert the state
return false; // false alarm!
}
else {
if (millis() - *marker >= interval) {
*buttonstate = 0; //debounced; update state
return false; // but not the event we want
}
else
return false; //not done yet; just move on
}
default: //error; recover anyway
{
*buttonstate = 0;
return false; // definitly false!

}
}
}

void setup() {
pinMode(redledPin, OUTPUT);
pinMode(greenledPin, OUTPUT);
pinMode(redbutton, INPUT);
pinMode(greenbutton, INPUT);
digitalWrite (redledPin, LOW);
digitalWrite (greenledPin, LOW);

pinMode(redbutton, INPUT);
digitalWrite(redbutton, HIGH); //enable pullup resistor

pinMode(greenbutton, INPUT);
digitalWrite(greenbutton, HIGH); //enable pullup resistor
}

void loop() {
// Toggle LED if button is debounced
if (buttondown(digitalRead(redbutton), &redbuttoncount, &redbuttonstate, 10UL )) {
if (digitalRead(redledPin))
digitalWrite (redledPin, LOW); else
digitalWrite (redledPin, HIGH);
}

// Toggle LED if button is debounced
if (buttondown(digitalRead(greenbutton), &greenbuttoncount, &greenbuttonstate, 10UL )) {
if (digitalRead(greenledPin))
digitalWrite (greenledPin, LOW); else
digitalWrite (greenledPin, HIGH);
}
}

The code you posted (badly) seems to have very little to do with what you describe.

Do you know how to read the signal from an RC receiver? There are many examples around. What receiver are you using?

Have you tried anything all? Please post some code that shows an attempt at doing what you want. What problems are you having?

Steve

Please remember to post your code between code tags, by pressing the </> button on the forum toolbar. This formats your code so that it is easier for forum members to read and copy/paste into their IDE if needed. You can also put code tags, like this [code] And paste your code in between [/code].

I wanted to make an LED come on when you press a button and stay on, then once you press the button again it goes off and stays off until you press the button again.

So, you want to use a button to toggle on and off an LED. I think you are making the code far too complicated. Have a look at the Arduino example for toggling an LED: https://www.arduino.cc/en/tutorial/switch

I wanted to make an LED come on with a Rc PWM signal and stay on, then once you a Send a RC PWM signal again it goes off and stays off until you Send a RC PWM signal again.

Just posting the same question over and over again but ignoring all the questions and comments you get is not a useful way to get help.

Steve