Friday, January 20, 2012

Hacked RC Car at Washington Prep and Sea Perch Build and Venice H.S.








 In this video Erica and Johayra are steering the car via the Boatduinode code that we got from Andy 'Tuna' Harris in Texas:



And in this video the boys get a chance to play as EZMoney and Louis further mod Andy's code and turn it into "Carduinode" code, specifically for running the RC car:



The code we are using is:
HACKED from Boatduinode by Andy 'Tuna' Harris. Here it is:



* f (activates rear motor in forward motion)
* r (activates front motor in right direction)
* b (activates rear motor in backward motion)
* l (activates front motor in left direction)
* s (stops rear motor)
* a (aligns front wheels motor)
* S (stops both motors)
*
* Note that pulling the pins LOW activates the motors, and
* pulling them HIGH stops them. I have no clue why, so I created
* power_on() and power_off() helper functions to make it less
* confusing.


int car_forward = 8;
int wheels_right = 9;
int wheels_left = 10;
int car_backward = 11;
int i;

void setup() {
Serial.begin(9600);

pinMode(car_forward, OUTPUT);
pinMode(wheels_right, OUTPUT);
pinMode(car_backward, OUTPUT);
pinMode(wheels_left, OUTPUT);

digitalWrite(car_forward, HIGH);
digitalWrite(wheels_right, HIGH);
digitalWrite(car_backward, HIGH);
digitalWrite(wheels_left, HIGH);
}

void power_on(int pin)
{
digitalWrite(pin, LOW);
}

void power_off(int pin)
{
digitalWrite(pin, HIGH);
}


void loop()
{
if (Serial.available() > 0) {
switch(Serial.read()) {
case 'f':
power_off(car_backward);
power_on(car_forward);
Serial.println("rear motor activated, moving forward");
break;
case 'r':
power_off(wheels_left);
power_on(wheels_right);
Serial.println("front motor activated, wheels turn right");
break;
case 'b':
power_off(car_forward);
power_on(car_backward);
Serial.println("rear motor activated, moving backward");
break;
case 'l':
power_off(wheels_right);
power_on(wheels_left);
Serial.println("front motor activated, wheels turn left");
break;
case 's':
power_off(car_forward);
power_off(car_backward);
Serial.println("rear motor stopped");
break;
case 'a':
power_off(wheels_right);
power_off(wheels_left);
Serial.println("front motor stopped, wheels are aligned");
break;
case 'S':
power_off(car_forward);
power_off(car_backward);
power_off(wheels_right);
power_off(wheels_left);
Serial.println("Both motors stopped");
break;
}
}
}





Here is a video of how we began the hack:






Later in the afternoon, at Venice High School Robotics Club, where the students had just returned from getting a finalist medal in the FRC competition,  we built two Sea Perch ROVs:












 Many of the students learned to solder for the first time (since the LEGO FIRST competitions they have been competing in don't require much in the way of soldering, but PORPOISE is soldering intensive!)





1 comment:

  1. Just a minor correction: Venice was at a FIRST Tech Challenge competition and does FTC robotics (like VEX)... FRC and Lego are other levels of robotics in the FIRST (For Inspiration and Recognition in Science and Technology) world.

    ReplyDelete