예제 #1
0
파일: main.c 프로젝트: jianingchen/epucklib
int main(void){

    el_initialization();
    el_calibrate_sensors();
    el_uart_use_reset_code(true,128);
    
    BootingProcedure01_SelectorBarrier();
    
    el_launch_process(Process_ConsoleLoop,NULL);

    el_main_loop();

    return 0;
}
예제 #2
0
파일: main.c 프로젝트: joekeo/epucklib
int main(){

    el_initialization();

    /*
     * This is to let the robot automaticaly reset when TinyBootloader
     * attemps to write a new HEX, so you dont need to touch the reset
     * button.
     * To achieve this, TinyBootloader also needs to be configured:
     * in "Options" tab, set "Codes to send first" to 6.
     */
    el_uart_use_reset_code(true,6);

    /*
     * Put the robot in silence when the selector is in 0~3.
     */
    BootingProcedure01_SelectorBarrier();


    // see documentation for details about "elu_printf" and the UART module
    elu_printf("Hello World! This is e-puck!\n");

    // setup some process, which will be concurrenly executed in "el_main_loop()"
    el_launch_process(Process_LED_PatternA,NULL);
    el_launch_process(Process_LED_PatternB,NULL);
    el_launch_process(Process_LED_Control,NULL);

    el_led_set(EL_LED_BODY,EL_ON);

    elu_printf("setup finished\n");

    // this it the loop to run everything, including Timer, Process and Trigger. 
    el_main_loop();

    return 0;
}
예제 #3
0
int main(int argc,char*argv[]){
    int i,j;
    char *p;
    el_camera_param *CameraSetting;
    el_mct k;
    el_handle T;
    el_handle trg;

    el_initialization();
    el_calibrate_sensors();
    el_uart_use_reset_code(true,128);
    
    booting_procedure01_selector_barrier();

    el_uart_send_string(EL_UART_1,"Hello World!\n");
    i = el_random_int(4,79);
    elu_println("%d,%f",i,(float)i/4.0f);
    
    p = (char*)malloc(64);
    k = el_get_masterclock();
    elu_snprintf(p,64,"%p\t%p\t%p",p,&i,&j);
    k = el_get_masterclock() - k;
    elu_println("%s",p);
    elu_println("%lu",k);
    free(p);

    el_ir_proximity_options()->WorkingMode = EL_IR_PROXIMITY_PULSE;
    el_config_ir_proximity(el_ir_proximity_options());
    el_config_stepper_motor(el_stepper_motor_options());

    k = el_get_masterclock();
    CameraSetting = el_camera_options();
#if 0
    CameraSetting->ExposureMode = EL_EXPOSURE_TIME;
    CameraSetting->ExposureTime = 10.0f;
#endif
    el_config_camera(CameraSetting);
    k = el_get_masterclock() - k;
    elu_println("%lu",k);
    
    CameraFrameCounter = 0;
    CameraFPS = 0;

    T = el_create_timer();
    el_timer_set_callback(T,Callback_CountCameraFPS,NULL);
    el_timer_start(T,1000);

    trg = el_create_trigger();
    el_trigger_set_process(trg,Trigger_Accelerometer_Process);
    el_trigger_set_event(trg,EL_EVENT_ACCELEROMETER_UPDATE);

    /*
    trg = el_create_trigger();
    el_trigger_set_process(trg,Trigger_InfraredReceiver);
    el_trigger_set_event(trg,EL_EVENT_IR_RECEIVER_INCOME);
    */
    el_enable_ir_receiver();
    el_enable_ir_proximity();
    el_enable_camera();
    el_enable_accelerometer();
    
    el_launch_process(Process_UART,NULL);
    el_launch_process(Process_IRRC,NULL);
    el_launch_process(Process_LED,NULL);
    
    el_main_loop();
    
    return 0;
}