Describe your robot: My robot's name is Juliana. She is a talented beeper

Describe yourself: While I don't know much about Computer Science, I'm excited to be learning it at USC. I play tennis and ski and I'm from Denver, Colorado.

Sensor Lab 1

After a bit of confusion, the sensors received correct signals and displayed them on Juliana's screen perfectly. yay

Erik's robot

Daria's Robot

Zach's Robot :

Sensor Lab 3

It was a cloudy in September when Juliana successfully used all five of her sensors, as well as "if", "while", and "for" statements to avoid obstacles and increase her general awesomeness.

Here's the code!

Fibonacci Spiral

My robot drew a Fibonacci Spiral!

The Code

Robot's Got Talent Assignment

Prelab

1. After displaying the battery level using the robot.getBattery sensor in the terminal, my robot will use the robot.getLight sensors to ensure the lights are on and, using an If statement to ensure this is true or an else statement if it isn’t the robot will display different texts to the terminal. After this, the robot will make sure nothing is in front of it using the robot.getObstacle sensor and it will use a While statement to play “I’m Shipping Up to Boston” until I block the obstacle sensor, forcing the robot to go to the next step of the talent show.

2. Using the If and Else statement to check the robot.getLine sensor, the IR sensors will be displayed on the terminal along with unique texts for the output of the Line sensors. After passing an If statement that ensures the battery has enough power to continue, a For statement is used to repeat a series of four actions five times to create one complete star out of five separately made parts.

3. For the surprise, I will use the rand function to generate a random integer. If the integer is greater than ten, the robot will drive forward, spin clockwise, and play an E then and F#. If the integer is not greater than ten, the robot will drive backwards, spin counterclockwise, and play an F# then an E. The robot will then disconnect.

4. My robot’s performance will transition from the song to drawing stage by myself manually blocking the Obstacle sensor and it will transition from the drawing stage to the surprise stage when it completes the For statement of drawing the star. The performance will end when the robot concludes the If or Else statement in which it goes forward or backward and spins clockwise or counterclockwise.

The code for those who want to read it

header file

header file and song! //

// Talents.cpp

#include

#include

#include

#include

#include

#include

#include "Talents.h"

using namespace std;

int main(int argc, char ** argv)

{

//Song

cout << "Battery Level is" << endl;

cout << robot.getBattery() << endl;

if (robot.getLight("center")!=0)

{cout << "Lights are on, time to start the show!" << endl;

}

else {

cout << "Why is it so dark in here?" << endl;

}

while (robot.getObstacle("center")==0) {

boston();

}

// Drawing

if (robot.getLine()[0]!=0) {

cout << "Here's what my IR sensors see!" << endl;

cout << robot.getIR()[0] << endl;

cout << robot.getIR()[1] << endl;

}

else {

cout << "The getLine Sensors are really inaccurate, but here is what my IR

sensors see" << endl;

cout << robot.getIR()[0] << endl;

cout << robot.getIR()[1] << endl;

}

if (robot.getBattery()>=6.2)

{

for (int n=0; n<=4; n++) {

robot.forward(.7,1);

robot.turnLeft(1.9,1);

robot.forward(.8,1);

robot.turnRight(.38,1);

}

// surprise

}

cout << "Now for the Surprise!" << endl;

srand(time (NULL));

int randInt = rand() % 51;

if (randInt >= 10)

{

cout << "Holy Moly! The number generated by randInt is greater than ten!" <<

endl;

robot.forward(1,2);

robot.turnRight(1,7);

robot.beep(.3, 1318.51),(.3, 659.26); /*E*/

robot.beep(.15, 1479.98); /*F#*/

}

else {

cout << "By the beard of Zeus! The number generated by randInt is less than 10!" << endl;

robot.backward(1,2);

robot.turnLeft(1,7);

robot.beep(.15, 1479.98); /*F#*/

robot.beep(.3, 1318.51),(.3, 659.26); /*E*/

disconnect();

return 0;

}

}

Video of the Talent

Valid XHTML 1.0 Transitional!Valid CSS!