#define TRANSMIT_FRQ 100 #define TRANSMIT_PRD 10000 #define RECEIVE_FRQ 100 void Ir() { int count; int bump; int ir; printf("TRANSMIT at 100Hz\n"); ir_transmit_on(); /* part la transmission*/ set_ir_transmit_period(TRANSMIT_PRD); /* fréquence de transmission à 100hz*/ sleep(0.1); ir_receive_on(); /* part la reception*/ set_ir_receive_frequency(RECEIVE_FRQ); /* fréquence de reception à 100 hz*/ sleep(.1); /* attend 100 milliseconde*/ bump = bumper(); while(bump == 0) { count = ir_counts(6); ir = ir_detect(); printf("Ir count: %d, irD: %d\n", count, ir ); bump = bumper(); sleep(.1); } printf("Stop emitting...\n"); ir_receive_off(); ir_transmit_off(); } void start_ir() { start_process(Ir()); }