Hello,


I wonder if you can help me?
I have just begin programing the e-puck, and i am having problens with the C language, when i use a AND instruction it reacts as an OR and vice versa. The code is below.
I am using the basic library from the e-puck main page.

#include "prox.h"
#include "led.h"
#include "motors.h"


int main(void)
{
    InitMotors();
    InitProx();
    int i;
    int valores_sensor[8];
 
   
    while(1){   
       

        for (i =0; i<8;i++)
            valores_sensor[i] = GetProx(i);


       

        if((valores_sensor[0] < 1000) || valores_sensor[7] < 1000 ){
            SetSpeedLeft(-500);
            SetSpeedRight(-500);                   
        }

        for(i = 0; i<2999;i++)
            asm("nop");

    }

}

with the code above it only moves when both sensors(0 and 7) are active.

Thank you for your time.

Kind regards,
Igor Antunes


Área de Clientes Clix – Toda a gestão dos seus serviços online!
http://cliente.clix.pt/.

Área de Clientes Clix – Toda a gestão dos seus serviços online!
http://cliente.clix.pt/.
_______________________________________________
E-puck-user mailing list
E-puck-user@gna.org
https://mail.gna.org/listinfo/e-puck-user

Reply via email to