int main(void) { LEDS_init(); /* init the LEDs for this board */ IO_init(FAST_IO); PWM_init(PWM_1|PWM_4); /* P0.0, P0.8 */ PWM_frequency(50); /* 50 Hz PWM output, 20ms */ LEDS_on(LED3); while(1) { if (flashen_button()) { PWM_pulsewidth_us (PWM_1, 1500); // Center PWM_pulsewidth_us (PWM_4, 1500); // Center LEDS_on(LED2); } else { PWM_pulsewidth_us (PWM_1, 1000); // 45º left PWM_pulsewidth_us (PWM_4, 2000); // 45º right LEDS_off(LED2); } } }
int main(void) { LEDS_init(); LEDon(LED_BLUE); ws2811_init(); clearAllLED(); //xTaskCreate(animation_task, (signed char*)"animation", 16, 0, 1, 0); //vTaskStartScheduler(); animation_task((void *) 0); return -1; }
/** * @brief Main program. * @param None * @retval None */ int main(void) { LEDS_init(); TIME_init(); US_init(); MOTORS_init(); USB_init(); //int x = 500; do { //TIME_delay(1000); for (int i=0; i < 10000000; i++) {} LEDS_live(!LEDS_live_state()); /*if (US_distance > 30) { MOTORS_forward(1000); } else { MOTORS_right(100); }*/ /*PROTOCOL_data data = {0,0,0,0,0};//PROTOCOL_emptyData; data.id = 1; data.cmd = 2; data.type = 0; data.bData = 3; USB_write(data);*/ /*LEDS_live(LEDS_On); TIME_delay(US_distance*10); LEDS_live(LEDS_Off); TIME_delay(US_distance*10);*/ /*if (x > 1000) x = 600; TIME_delay(1000); MOTORS_forward(x); x+= 10;*/ USB_power(1); //TIME_delay(100); for (int i=0; i < 10000000; i++) {} USB_power(0); } while (1); }
/************************************************************************* main ==== **************************************************************************/ int main(void) { IO_init(SLOW_IO); LEDS_init(); /* init the LEDs for this board */ // initialise the SD card BlockDevInit(); DBG("Initialising USB stack\n"); // initialise stack USBInit(); // enable bulk-in interrupts on NAKs // these are required to get the BOT protocol going again after a STALL USBHwNakIntEnable(INACK_BI); // register descriptors USBRegisterDescriptors(abDescriptors); // register class request handler USBRegisterRequestHandler(REQTYPE_TYPE_CLASS, HandleClassRequest, abClassReqData); // register endpoint handlers USBHwRegisterEPIntHandler(MSC_BULK_IN_EP, MSCBotBulkIn); USBHwRegisterEPIntHandler(MSC_BULK_OUT_EP, MSCBotBulkOut); DBG("Starting USB communication\n"); // connect to bus USBHwConnect(TRUE); LEDS_on(LED1); // call USB interrupt handler continuously while (1) { USBHwISR(); } return 0; }