Frankenbot

1.4K11

Intro: Frankenbot

This is Frankenbot he is a toy robot with 2 modes of propulsion, foward and reverse speed, 180 deg. turning ratio, and is comprised of other toys(minus arduino/breadboard and components)....
The main body, rear wheels, battery pack, and motor are from a cheap rc car i bought at a garage sale for a $1, this is the first mode of propulsion.
The front wheels and the rest of the upper body are made from an erector set.
The steering servo, motor and prop are from a rc airplane, this is the secondary mode of propulsion.
The lipo battery pack and esc came from a losi rc buggy
And of coarse the brains of this monster is an arduino uno microcontroller and solderless breadboard.
Addition components used were jumper wires, twisty ties, duct tape, cardboard box, and a voltage regulator.

To see video please go to this youtube link   http://www.youtube.com/watch?v=KsBWHQeahe4&feature=youtu.be

 -CODE BELOW-

#include <Servo.h>

Servo esc;  // setup esc just like a servo
Servo sts;  // steering servo
boolean steering1flag = true;   //steering 1 will only run if this is true
boolean steering2flag = false;  //steering 2 will only run if this is true.
unsigned long steeringtimer1;
unsigned long steeringtimer2;
boolean motortimer1flag  = true;   //motor 1 will only run if this is true
boolean motortimer2flag  = false;  //motor 2 will only run if this is true.
unsigned long motortimer1 ;
unsigned long motortimer2 ;

void setup()
{
  motortimer1 = millis();    //start the watch for motor 1
  steeringtimer1 = millis();    //start the watch for steering 1
  esc.attach(5); // esc attach to pin 5
  sts.attach(9); // steering servo attach to pin 9
  esc.writeMicroseconds(1500);  // set esc to 0 "or midi-point on servo
  sts.write(90);  // set steering servo to mid-point
}

void loop()
{
  if (millis() - motortimer1 >= 5000 && motortimer1flag == true)  //has ? seconds passed AND do I need to run the motors?
   { 
    esc.write(1680);    //turn esc on forward
    motortimer2 = millis(); //start the watch for motortimer2
    motortimer1flag = false; // motortimer1 doesn't need to run again
    motortimer2flag = true;  // motortimer2 has to go.
   }
  if (millis() - motortimer2 >= 6500 && motortimer2flag == true)
   {
    esc.write(1300);   //turns esc on reverse
    motortimer1 = millis();   //start the watch for motortimer1
    motortimer2flag = false;  // motortimer1 has to go again
    motortimer1flag = true;  // motortimer2 has to wait
   }
//--------------------------------------------------------------------------------------------------
  if (millis() - steeringtimer1 >= 2800 && steering1flag == true)  //has ? seconds passed AND do I need to run the steering?
   { 
    sts.write(55);    //turn steering servo
    steeringtimer2 = millis(); //start the watch for steering 2
    steering1flag = false; // steering 1 doesn't need to run again
    steering2flag = true;  //steering 2 has to go.
   }
  if (millis() - steeringtimer2 >= 2800 && steering2flag == true)
   {
    sts.write(129);   //turns steering servo
    steeringtimer1 = millis();   //start the watch for steering 1
    steering2flag = false;  //steering 1 has to go again
    steering1flag = true;  //steering 2 has to wait
   }
}


Comments

Igor pull the switch!

IT'S ALLIVE!!!!!!