/*Uses a series of movemnts to make a square*/ void square(){ forward(); turnr(); forward(); turnr(); forward(); turnr(); forward(); turnr(); }
int main() { create_connect(); go(457.2,250); resetd(); while (get_create_total_angle(10) < 90) {turnl(250);} reseta(); go(457.2,250); resetd(); while (get_create_total_angle(10) > -90) {turnr(250);} reseta(); go(250,250); while (get_create_total_angle(10) > -90)//Riddhi..your job is to write a //function like mine, go, that makes an easy command to turn the robot. {turnr(250);} reseta(); go(400,250); resetd(); motor(3,50); sleep(1.5);//this is to lower the cage thing for the green //and pink containers. might have to go forward or backward. go(-400,250);//to go backwards resetd(); while (get_create_total_angle(10) < 90) {turnl(250);} reseta(); go(-457.2,250); resetd(); //need help with steps 13-21 on the pseudocode. while (analog(2) < 100) {create_drive_straight(250);} //to raise the cage, and leave the filled containers of luggage. motor(3,50); sleep(1.5); enable_servos(); get_servo_position(2); if (get_servo_position(2) > 1023) {set_servo_position(2,get_servo_position(2)-1023);} if (get_servo_position(2) < 1023) {set_servo_position(2,get_servo_position(2)+1023);} }
int main() { printf("Online%\n\r"); wait_ms(500); w1_cha.fall(&count_w1_a); w1_chb.fall(&count_w1_b); w2_cha.fall(&count_w2_a); w2_chb.fall(&count_w2_b); /* test maneuvers */ forward(); backward(); turnr(); turnl(); turnl(); square(); while(1) { if (w1_count_a != w1_dif_a){ w1_dif_a = w1_count_a; printf("w1 count a = %d\n\r", w1_dif_a); } if (w1_count_b != w1_dif_b){ w1_dif_b = w1_count_b; printf("w1 count b = %d\n\r", w1_dif_b); } if (w2_count_a != w2_dif_a){ w2_dif_a = w2_count_a; printf("w2 count a = %d\n\r", w2_dif_a); } if (w2_count_b != w2_dif_b){ w2_dif_b = w2_count_b; printf("w2 count b = %d\n\r", w2_dif_b); } myled = !myled; } }