Tuesday, January 19, 2010

Scanter Experiments

 After establishing the circuit needed to control the remote control of the tank, First experiments were made in order to establish how it would be possible to control the motion.

As a first try, a square like motion is being created:

 /*
 The ScanTer

 This script is ment to control a RC tank.
 It creates a square like motion

 Created 19 January 2010
 By Pula_Team; Tudor Cosmatu & Grygorii Zotov

 based on "Blink" example

 */

int LFPin = 8;// Right switch forward
int RFPin = 7;// left swith forward

int var = 0;

void setup()   {              
  // initialize the digital pin as an output:
  pinMode(LFPin, OUTPUT);
  pinMode(RFPin, OUTPUT);
  //pinMode(greenPin, OUTPUT); 
}

void loop(){
  while(var <= 3){
    // do something repetitive 4 times
    digitalWrite(LFPin, HIGH);
    digitalWrite(RFPin, HIGH);    // set the LED off
    delay(700);
    digitalWrite(LFPin,LOW);
    digitalWrite(RFPin, LOW);
    delay(10);
    digitalWrite(LFPin,HIGH);
    delay(255);
    digitalWrite(LFPin,LOW);
    delay(10);
  
    var++;
  }


}




By setting both of the pins on and off at once, the tank moves forward:


    digitalWrite(LFPin, HIGH);
    digitalWrite(RFPin, HIGH);    // set the LED off
    delay(700);


    digitalWrite(LFPin,LOW);
    digitalWrite(RFPin, LOW);
    delay(10);




Robotics from Tudor Cosmatu on Vimeo.

In order to generate a circular motion one of the motors needs to run longer than the other so by splitting the circle into linear segments you get a circulary motion:

/*
 The ScanTer

 This script is ment to control a RC tank.
 It creates a circle like motion

 Created January 2010
 By Pula_Team; Tudor Cosmatu & Grigorii Zotov

 based on "Blink" example

 */

int LFPin = 8;// Right switch forward
int RFPin = 7;// left swith forward

int var = 0;

void setup()   {               
  // initialize the digital pin as an output:
  pinMode(LFPin, OUTPUT);
  pinMode(RFPin, OUTPUT);
  //pinMode(greenPin, OUTPUT);  
}

void loop(){
    while(var<=50 ){


      digitalWrite(LFPin, HIGH);
      digitalWrite(RFPin, HIGH);    // set the LED off
      delay(200);
      digitalWrite(RFPin,LOW);
      digitalWrite(LFPin,HIGH);
      delay(50);
      digitalWrite(LFPin,LOW);
      delay(1);
      var++;
    }
}


In this part both of the motors are switched on, therefore creating a linear motion:

      digitalWrite(LFPin, HIGH);
      digitalWrite(RFPin, HIGH);    // set the LED off
      delay(200);
      digitalWrite(RFPin,LOW);


And after a small delay, you get the redirection of the RC tank:

     digitalWrite(RFPin,LOW);
      digitalWrite(LFPin,HIGH);
      delay(50);
      digitalWrite(LFPin,LOW);
      delay(1);
 


images and videos will follow 




Robotics from Tudor Cosmatu on Vimeo.


Robotics from Tudor Cosmatu on Vimeo.


No comments:

Post a Comment