I am using a Futaba receiver and transmitter. My objective is very simple - When I toggle a switch in the RC transmitter the LED(connected to PIN 13) should light up and when I toggle to the other position it should switch off.
I power up the receiver from the 5V of the Arduino UNO and the grounds of both RC receiver and Arduino UNO are connected together. My problem is, when the switch is at low position the light is off and when the switch is at high position the light is BLINKING RANDOMLY!!!!
THE BLINKING NEVER STOPS as long as the switch is in High Position.
I tried using the proportional switches there is no problem. Only when I use a simple toggle switch with ON and OFF position this problem occurs...
Basically when the switch is at Low position it produces a High pulse for 950us for every 14 ms and when the switch is at High position it produces a High pulse for 2050us for ever 14ms = PWM signal and hence my reasoning to choose 1050us in the codes so to choose a middle value between 950us and 2050us.
/* Codes for the RC switch to on and off LED */
int autopilot = 3;
int thr_output = 13;
unsigned long duration;
duration = pulseIn(autopilot, HIGH);
if (duration < 1050)
Please enlighten me why is this problem and what can I do to solve this??