/* This will sketch will read channels of a RC receiver and input the values via serial monitor. Programmed for the Arduino Uno for use with the robot named Rodney. Lastly my transmitter is programed for Channel mixing, Elevons or Elevator/Aileron mixing. Rodney is a crude dual h-bridge setup for two wheel chair motors in tank steer configuration. I only need to output a direction pin and the PWM signal for each motor control. ===========================================================================================*/ //Included Libraries //Enable debug mode to input data via serial /*0=OFF, 1=Engineering Data On, 2=Raw Data On, 3=Servo value Output, 4=Raw Eng & Servo Data Output, 5=Tank steer data output,*/ const int debug=5; //Arrays for Channel pin locations and Channel data const int channels=2; const int chPin[]={2,3,4,5,6,7,8,9}; //Pin locations int chEng[6]; //Store massaged data const int M1=5; //M1 PWM const int M2=6; //M2 PWM const int M1D=7;//M1 Direction const int M2D=8;//M2 Direction //RX signal massaging values const int RXLo=1185; const int RXHi=1835; const int RXDeadLo=1470; const int RXDeadHi=1520; const int RXMid=1500; //Motor Ranges const int MotorLo=75; const int MotorHi=255; //Motor Variables int M1PWM=0; int M1DIR=0; int M2PWM=0; int M2DIR=0; //Setup pin locations, start serial void setup(){ //Precursor to Failsafe Reset Below digitalWrite(12,HIGH); if(debug > 0){ Serial.begin(115200); //We're going PLAID! } //Input Pins: for (int i=0; i= RXDeadLo){ //Create Dead-Band chEng[i] = RXMid; } }//End of For Loop //Output signals for Motor Controller //Motor 1 if (chEng[0]>RXMid){ M1PWM=map(chEng[0],RXMid,RXHi,MotorLo,MotorHi); analogWrite(M1,M1PWM); M1DIR=0; digitalWrite(M1D,LOW); } else if (chEng[0]RXMid){ M2PWM=map(chEng[1],RXMid,RXHi,MotorLo,MotorHi); analogWrite(M2,M2PWM); M2DIR=0; digitalWrite(M2D,LOW); } else if (chEng[1]