// Mission 1 const motorL = ev3_motorA(); // A port const motorR = ev3_motorD(); // D port display(ev3_connected(motorL) ? "L connected" : "L not connected"); display(ev3_connected(motorR) ? "R connected" : "R not connected"); // Q1 function speak(words) { return ev3_speak(words); } // speak("I am human"); // ok works // Q2 //circum of wheel: 6 pi function move_forward(length) { // length, in cm const speed = 100; const pos = length/(6 * math_PI) * 360; // pos (in deg): degree turned by wheel // const time = 1 * 1000; const time = math_abs(pos/speed) * 1000; // time (in ms): pos(deg), speed(degree/second) //math_abs to keep time always positive // doc: ev3_runToRelativePosition(motor, position, speed); ev3_runToRelativePosition(motorL, pos, speed); ev3_runToRelativePosition(motorR, pos, speed); return ev3_pause(time); // do we need a return value? } // move_forward(-10); // 10cm // Q3 function turn(deg) { // clockwise const speed = 100; const time = math_abs(deg * 2/ speed) * 1000; ev3_runToRelativePosition(motorL, deg * 2, speed); ev3_runToRelativePosition(motorR, - (deg * 2), speed); return ev3_pause(time); } const turn_left = () => turn(90); // makes it a function instead of funct call const turn_right = () => turn(-90); // Q4 function mission1_q4() { move_forward(10); turn_left(); move_forward(5); turn_right(); move_forward(15); } mission1_q4(); /* ATTENDANCE CHECK PRATEEK yijie hazel clemen Hari jiesheng zele James */