presentation-hour-of-code



presentation-hour-of-code

0 0


presentation-hour-of-code


On Github tybenz / presentation-hour-of-code

Fetch

Read

Execute

Carduino

Square

delay = 0.5;

void loop() {
    moveForward();
    turnLeft();
}

Spin

delay = 0;

void loop() {
    turnRight();
}

Circle

delay = 0.1;

void loop() {
    moveForward();
    turnLeft();
}

Letter "P"

delay = 0.5;

moveForward();
moveForward();
moveForward();
turnRight();
moveForward();
moveForward();
turnRight();
moveForward();
turnRight();
moveForward();
turnLeft();
moveForward();
moveForward();

Your turn!

Build Move Forward Turn Right Turn Left

long toTheLeft, toTheRight; long inFront = ping(FRONT); if (inFront > 12) { car->moveForward(); } else { stop(); delay(1); toTheRight = ping(RIGHT); delay(1); toTheLeft = ping(LEFT); if (toTheLeft > 12) { turnLeft(); } else if (toTheRight > 12) { turnRight(); } else { // turnaround turnLeft(); turnLeft(); } }