u5 Lya Propuesta de Lenguaje Gustavo Olaf Felix Chan

5
INSTITUTO TECNOLOGICO SUPERIOR DE ESCARCEGA INGENIERIA EN SISTEMAS COMPUTACIONALES VI SEMESTRE ING. CAROLINA NOVELO CAN LENGUAJES Y AUTÓMATAS I UNIDAD : 5 TAREA: PROPUESTA DE LENGUAJE BR. LIZBETH PEREZ PEREZ BR. GUSTAVO FELIX CHAN BR. YOLANDA TORRES HUICAB BR. JOSE ALEJANDRO TORRES BR. JESUS OMAR ESCAYOLA CALDERÓN BR. VERÓNICA ADRIANA HERNÁNDEZ ALMARO

description

Sumobots

Transcript of u5 Lya Propuesta de Lenguaje Gustavo Olaf Felix Chan

INSTITUTO TECNOLOGICO SUPERIOR DE ESCARCEGAINGENIERIA EN SISTEMAS COMPUTACIONALESVI SEMESTREING. CAROLINA NOVELO CANLENGUAJES Y AUTMATAS IUNIDAD : 5TAREA: PROPUESTA DE LENGUAJEBR. LIZBETH PEREZ PEREZBR. GUSTAVO FELIX CHANBR. YOLANDA TORRES HUICABBR. JOSE ALEJANDRO TORRESBR. JESUS OMAR ESCAYOLA CALDERN BR. VERNICA ADRIANA HERNNDEZ ALMAROBR. JESS JUREZ GONZLEZ

El proyecto integrador (sumobot), es un autmata finito que es programado en Arduino por la placa que utiliza, la cual es Arduino Uno. Este utiliza un lenguaje en comn, basado en C, para procesadores. Definimos pruebas acerca de las acciones del sumobot y los estados en que sea posible encontrarse en dichas situaciones, para no perder el juego.Las estrategias a utilizar en el sumo fueron entregadas anteriormente, y de stas formamos el cdigo en el lenguaje C para la programacin del procesador ATMEGA8-16PU.

La estructura analizada quedara de la siguiente forma:#include

int main(void){ //llamar funciones:iniciar();

return 0;}

int iniciar(){ //funcin que inicia las acciones del sumo return 0;}int acelerarServoIzq(int grados){ return grados; //avanza por grados a la izquierda}int acelerarServoDerecha(int grados){ return grados; //avanza por grados a la derecha}int acelerarServoAdelante(int grados){ return grados; //avanza hacia adelante}int acelerarServoAtras(int grados){ return grados; //avanza hacia atrs}

- - - - - - - - - - - - - - -- - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include

/* * This example uses the ZumoMotors library to drive each motor on the Zumo * forward, then backward. The yellow user LED is on when a motor should be * running forward and off when a motor should be running backward. If a * motor on your Zumo has been flipped, you can correct its direction by * uncommenting the call to flipLeftMotor() or flipRightMotor() in the setup() * function. */

#define LED_PIN 13

ZumoMotors motors;

void setup(){ pinMode(LED_PIN, OUTPUT); // uncomment one or both of the following lines if your motors' directions need to be flipped //motors.flipLeftMotor(true); //motors.flipRightMotor(true);}

void loop(){ // run left motor forward digitalWrite(LED_PIN, HIGH); for (int speed = 0; speed = 0; speed--) { motors.setLeftSpeed(speed); delay(2); } // run left motor backward digitalWrite(LED_PIN, LOW); for (int speed = 0; speed >= -400; speed--) { motors.setLeftSpeed(speed); delay(2); } for (int speed = -400; speed = -400; speed--) { motors.setRightSpeed(speed); delay(2); } for (int speed = -400; speed