703-475-8252

©2019 by Robot Revolution

CODE AND COMPONENTS

CODE

#include "PPMDecoder.h"
int side1 = 9;
int side2 = 10;
int side1R = 11;
int side2R = 12;
int side1val = PPM.getChannelValue(3);
int side2val = PPM.getChannelValue(2);
int side1valup;
int side1valdown;
int side2valup;
int side2valdown;
void setup() {
  PPM.begin(2);
  PPM.setChannnel(1,PPM2PWM,4);
  PPM.setChannnel(2,PPM2PWM,5);
  PPM.setChannnel(3,PPM2PWM,6);
  PPM.setChannnel(4,PPM2PWM,7);
  PPM.setChannnel(5,PPMSelector,8);
  Serial.begin(9600);

  pinMode(side1, OUTPUT);
  pinMode(side2, OUTPUT);
}

void loop() {
/*   for( int i=1;i<6;i++){
    Serial.print("Channel(");
    Serial.print(i);
    Serial.print("):");
    Serial.print(PPM.getChannelValue(i));
    Serial.print("\t");
   }*/
   side1val = PPM.getChannelValue(3);
   side2val = PPM.getChannelValue(2);
//side1
   if(side1val<1572 && side1val>1424)
   {
    side1valup = 0;
    side1valdown = 0;
    analogWrite(side1, 0);
   }
   if(side1val>=1572)
   {
//    Serial.println(side1val);
    side1valup = map(side1val, 1572, 1950, 60, 255);
    digitalWrite(side1R, HIGH);
    analogWrite(side1, side1valup);
   }
   if(side1val<=1424)
   {
    side1valdown = map(side1val, 1424, 1050, 60, 255);
    digitalWrite(side1R, LOW);
    analogWrite(side1, side1valdown);
   }

//side2
   if(side2val<1568 && side2val>1400)
   {
    side2valup = 0;
    side2valdown = 0;
    analogWrite(side2, 0);
   }
   if(side2val>=1568)
   {
//    Serial.println(side1val);
    side2valup = map(side2val, 1568, 1950, 60, 255);
    digitalWrite(side2R, HIGH);
    analogWrite(side2, side2valup);
   }
   if(side2val<=1400)
   {
    side2valdown = map(side2val, 1400, 1050, 60, 255);
    digitalWrite(side2R, LOW);
    analogWrite(side2, side2valdown);
   }


   Serial.println(side1valup);
   Serial.println(side1valdown);
   Serial.println(side2valup);
   Serial.println(side2valdown);
//   Serial.println(side2val);
   delay(10);
}
//throttle 1572, top half tick
//throttle 1424, bottom half tick
//throttle 1936, max
//throttle 1088, min
//throttle 1504, middle
//right 1568, top half tick
//right 1400, bottom half tick
//right 1928, max
//right 1072, min
//right 1504, middle

COMPONENTS

Drive Motors: Direct Drive Hub Brushless 1/4 horsepower
Spinner Motors: Turnigy RotoMax 1.60 Brushless Outrunner Motor
Outermost Armor: 1/8" A36 steel
Frame: 3/16" A36 Steel Angle Iron
Spinner: layered A36 steel
Chain: #50H Chain