void ServosWidget::disable() { // Disable current servo const int port = ui->dial->label(); disable_servo(port); publish(); // Update enable/disable button visibility ui->enable->show(); ui->disable->hide(); }
// Created on Sat April 13 2013 // This is a transport move test. int main() { wait_for_light(3); // start the robot after the light is turned on shut_down_in(120); // shutdown the robot in 2 Minutes enable_servo(); printf("Hello, World!\n"); set_servo_position(1, 0); motor(1,100); // move the right wheel motor(3,100); // move the left wheel msleep(3500); // move for 3.5 seconds ao(); set_servo_position(1, 2048); // kick bot guy out motor(1,-100); motor(3,-100); disable_servo(); return 0; }
VI void disable_servos() { for(int i = 0; i < 4; ++i) disable_servo(i); }
void ServoTestWizardPage::servoOff(const quint16 &port) { disable_servo(port); }
int main() { int m1=0,m2=3,pageno=0; double createDriveTime; printf("Start!\n"); extra_buttons_show(); while (1) { while (pageno == 0) { set_a_button_text("Forward"); set_b_button_text("Backward"); set_c_button_text("All Off"); set_x_button_text("OpenHand"); set_y_button_text("CloseHand"); set_z_button_text("Create Page"); if (a_button_clicked()) { printf("Moving forward...\n"); motor(m1,100); motor(m2,100); while (!c_button_clicked()) { msleep(1); } ao(); } if (b_button_clicked()) { printf("Moving backward...\n"); motor(m1,-100); motor(m2,-100); while (!c_button_clicked()) { msleep(1); } ao(); } if (x_button_clicked()) { enable_servo(3); set_servo_position(3,0); msleep(300); disable_servo(3); } if (y_button_clicked()) { enable_servo(3); set_servo_position(3,1300); msleep(300); disable_servo(3); } if (z_button_clicked()) { pageno=1; create_connect(); } } while (pageno == 1) { set_a_button_text("Create Fwd"); set_b_button_text("Create Bwd"); set_c_button_text("Stop"); set_x_button_text("Turn R"); set_y_button_text("Turn L"); set_z_button_text("M S Page"); if (a_button_clicked()) { createDriveTime = 0; printf("Create Moving forward w/ spd 100...\n"); create_drive_straight(100); createDriveTime = seconds(); while (!c_button_clicked()) { msleep(1); } create_stop(); printf("Time: %f seconds\n",seconds() - createDriveTime ); } if (b_button_clicked()) { createDriveTime = 0; printf("Create Moving backward w/ spd 100...\n"); create_drive_straight(-100); createDriveTime = seconds(); while (!c_button_clicked()) { msleep(1); } create_stop(); printf("Time: %f seconds\n",seconds() - createDriveTime ); } if (x_button_clicked()) { create_drive(-50,0); while (!c_button_clicked()) { msleep(1); } create_stop(); } if (y_button_clicked()) { create_drive(50,0); while (!c_button_clicked()) { msleep(1); } create_stop(); } if (z_button_clicked()) { pageno=0; create_disconnect(); } } } return 0; }
// ============================================================================================ // receive packet // ============================================================================================ // this repeats code in key_press void rx_pkt(Xgrid::Packet *pkt) { uint8_t port = pkt->rx_node; //pkt->rx_node char command; if(port >= 0 && port < NUM_NEIGHBORS) { if(pkt->type == MESSAGE_COMMAND) { char* char_ptr = (char*) pkt->data; command = *char_ptr; connected[port] = true; switch(command) { case 'Z': reboot_on = true; case 'D': speedup_on = false; communication_on = false; disable_servo(); break; case 'R': speedup_on = true; communication_on = true; enable_servo(); break; case 'i': init_variables(); break; case 'r': sec_counter = 0; break; case 'I': init_variables(); sec_counter = 0; break; case 'a': wave_flg = true; wave_port = port; break; case 'b': column_flg = true; break; case 'c': sync = false; break; case '1': sec_counter = STGtime1; init_variables(); break; case '2': sec_counter = STGtime2; init_variables(); break; case '3': sec_counter = STGtime3; init_variables(); break; case '4': sec_counter = STGtime4; init_variables(); break; case '5': sec_counter = STGtime5; init_variables(); break; case '6': sec_counter = STGtime6; init_variables(); break; case '7': sec_counter = STGtime7; init_variables(); break; case '8': sec_counter = STGtime8; init_variables(); break; case '9': sec_counter = STGtime9; init_variables(); break; case '0': sec_counter = LASTtime; init_variables(); break; } } if(pkt->type == MESSAGE_NUMDATA) { connected[port] = true; point* pt_ptr = (point*) pkt->data; agent0.neix[port] = pt_ptr->x0; agent0.neiy[port] = pt_ptr->y0; agent1.neix[port] = pt_ptr->x1; agent1.neiy[port] = pt_ptr->y1; } //LED_PORT.OUTTGL = LED_USR_2_PIN_bm; //green LED } }