Advertisement
Aichan

Untitled

May 16th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.29 KB | None | 0 0
  1.  /********************************************************************
  2.  
  3.  Author       : Brose Christophe
  4.  
  5.  Date         : 19/03/2013
  6.  
  7.  File         : MAIN.C
  8.  
  9.  Hardware     : ADUC832
  10.  
  11.  Description  : Brique de base pour Boe-Bot
  12.  
  13. ********************************************************************/
  14.  #define MAIN                   // Ne pas modifier
  15.  
  16.  #include "RobotLib.h"          // Librairie de base
  17.  #include <string.h>
  18.  void main()
  19.  {
  20.  int i;
  21.   char antenneGauche[] = "Detection antenne gauche";
  22.   char antenneDroite[] = "Detection antenne droite";
  23.   char frontal[] = "Detection frontale";
  24.   char noObstacle[] = "Pas d'obstacle";
  25.  InitRobot();
  26.   // Initialisation de la RAM étendue, de la fréquence du µc, de l'UART et des ports en entrées
  27.   while(1)
  28.   {        
  29.     for(i=0;i<strlen(noObstacle);i++)
  30.         {
  31.             SerSend(noObstacle[i]);
  32.         }
  33.      while(P8 && P9);
  34.      if(!P8) //collision antenne gauche
  35.      {
  36.        if(!P9)
  37.        {
  38.          for(i=0;i<strlen(frontal);i++)
  39.          {
  40.            SerSend(frontal[i]);
  41.          }
  42.        }
  43.        else
  44.        {
  45.           for(i=0;i<strlen(antenneGauche);i++)
  46.          {
  47.            SerSend(antenneGauche[i]);
  48.          }
  49.        }
  50.      }
  51.      else
  52.      {
  53.        
  54.        if(!P9)
  55.        {
  56.         //Envoie message collision antenne droite
  57.         for(i=0;i<strlen(antenneDroite);i++)
  58.          {
  59.            SerSend(antenneDroite[i]);
  60.          }
  61.          }
  62.      }
  63.   }
  64.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement