[Projet]Arduino et EMIC 2
Répondre à la discussion
Affichage des résultats 1 à 12 sur 12

[Projet]Arduino et EMIC 2



  1. #1
    MajProblem

    [Projet]Arduino et EMIC 2


    ------

    Bonjour,

    Je poste ici car , je ne vais pas vous le cacher, je suis en difficulté
    J'ai pour projet de faire parler un module Emic 2 dans le cadre d'un projet de casque moto gps , ou le casque nous donne la direction grâce a ce module

    Mon professeur ayant beaucoup d'éleve a guider, je n'ai pas eu beaucoup d'occasions de lui demander de l'aide

    Voila ou j'en suis pour le code

    Code:
    #include <SoftwareSerial.h>
    
    #define rxPin 2    // Serial input (connects to Emic 2 SOUT)
    #define txPin 3    // Serial output (connects to Emic 2 SIN)
    #define ledPin 13  // Most Arduino boards have an on-board LED on this pin
    
    char car_recu;
    
    // set up a new serial port
    SoftwareSerial emicSerial =  SoftwareSerial(rxPin, txPin);
    
    void setup()  // Set up code called once on start-up
    {
      // define pin modes
      pinMode(ledPin, OUTPUT);
      pinMode(rxPin, INPUT);
      pinMode(txPin, OUTPUT);
      
      // set the data rate for the SoftwareSerial port
      emicSerial.begin(9600);
      
      Serial.begin(9600);
      
      digitalWrite(ledPin, LOW);  // turn LED off
      
       emicSerial.print('\n');             // Send a CR in case the system is already up
      while (emicSerial.read() != ':');   // When the Emic 2 has initialized and is ready, it will send a single ':' character, so wait here until we receive it
      delay(10);                          // Short delay
      emicSerial.flush();                 // Flush the receive buffer
      
    }
    
      
    void loop()   {
      
      
      if (Serial.available()) 
      char car_recu = Serial.read(); 
    
      
      if(car_recu == 1){
      emicSerial.print('S');
      emicSerial.print("Continuey tou droi");
      emicSerial.print('\n');
     
      
      while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
      
      
      }
      
      else if(car_recu == 2){
      emicSerial.print('S');
      emicSerial.print("toohrney aa drrwat");
      emicSerial.print('\n');  
      
      while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
      
      }
      
      else if(car_recu == 3){
      emicSerial.print('S');
      emicSerial.print("toohrney aa goshe");
      emicSerial.print('\n');
      
    
      while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
      
      }
      
     else if(car_recu == 4){
    
      emicSerial.print('S');
      emicSerial.print("fate demi tour avec prudanss");
      emicSerial.print('\n');
      
      
      while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
      
      }
      
     
      
      else if(car_recu == 5){
      
      emicSerial.print('S');
      emicSerial.print("oh rohn poueinn , preneeh la , preue me r , sortie");
      emicSerial.print('\n');
     
       
      while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
     
      }
      
      else if(car_recu == 6){
      
      emicSerial.print('S');
      emicSerial.print("oh rohn poueinn , preneeh la , de ze m  , sortie");
      emicSerial.print('\n');
      
      while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
      
      }
       
      else if(car_recu == 7){
     
      emicSerial.print('S');
      emicSerial.print("oh rohn poueinn , preneeh la , troua z m , sortie");
      emicSerial.print('\n');
     
      while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
      
      
    
      
       } }
    Apres avoir téléversé ce programme dans mon Arduino Uno, j'ouvre mon moniteur série, je rentre les valeurs en question , et rien..



    Je vous demande humblement de l'aide, je ne sais que faire

    -----

  2. #2
    Antoane
    Responsable technique

    Re : [Projet]Arduino et EMIC 2

    Bonjour, et bienvenue sur futura.

    Comme expliqué ici : http://forums.futura-sciences.com/pr...ves-forum.html, les question sur les micro-controleurs, et donc a fortiori sur les arduino, doivent être postées en électroniques.


    Et un up gratuit au passage

    Bonne journée.
    Deux pattes c'est une diode, trois pattes c'est un transistor, quatre pattes c'est une vache.

  3. #3
    MajProblem

    Re : [Projet]Arduino et EMIC 2

    Merci du up et de la redirection !

  4. #4
    Yoruk

    Re : [Projet]Arduino et EMIC 2

    Donne la doc de ton truc et le schéma, histoire qu'on comprenne...

    Dis-nous également quel est le but de ton projet ? A quoi sert le truc ?
    La robotique, c'est fantastique !

  5. A voir en vidéo sur Futura
  6. #5
    MajProblem

    Re : [Projet]Arduino et EMIC 2

    Ce projet consiste en un casque de moto GPS, avec audio
    Mon groupe se compose de 4 personnes :
    La première s'occupe du programme sur androïde
    la deuxième s'occupe de la partie GPS
    La troisième de la liaison entre le casque et le système androïde (bluetooth)
    la quatrième (moi) génère une voix avec les instructions selon le "numéro" que m'envoie mon collègue numéro 2

    Par exemple il m'envoie un "1" et mon programme envoie un "Continuer tout droit" (écrit "Continuey tou droi" car la carte EMIC étant faite pour parler anglais, j'ai du jouer sur la phonétique)

    Pas de schéma sinon

  7. #6
    Yoruk

    Re : [Projet]Arduino et EMIC 2

    Citation Envoyé par MajProblem Voir le message
    Pas de schéma sinon
    Et bin repasse quand tu en auras un...

    Que veux tu qu'on dise d'un code si on ne sais même pas à quoi est branchée la carte ? On a pas la doc du module non plus...

    Après, quand je vois ça :

    Code:
    if(car_recu == 1){
     
    (...) 
      
    
      else if(car_recu == 2){
     
      
    (...)
    
      else if(car_recu == 3){
    Déjà j'ai envie de te conseiller d'utiliser un switch case, beaucoup plus adapté que des ifs qui s'enchainent. Et tu testes ta variable car_recu pas comme il faut. Documente toi sur le codage des données ascii et le type de variable renvoyé par l'UART de l'arduino. Tu devrais comprendre ton souci normalement.
    La robotique, c'est fantastique !

  8. #7
    bertrandbd

    Re : [Projet]Arduino et EMIC 2

    Bonjour

    Ton schéma ressemble à celui-ci

    http://www.google.fr/imgres?imgurl=h...ed=0CCEQrQMwAA

    A+

  9. #8
    Yvan_Delaserge

    Re : [Projet]Arduino et EMIC 2

    Citation Envoyé par Yoruk Voir le message
    Et tu testes ta variable car_recu pas comme il faut.
    Hello Yoruk,

    Tu veux dire qu'il faudrait écrire:
    if(car_recu == "1") ?
    ou bien if(car_recu == '1') ?
    Un civet, un plat de côtes et puis, glissez-moi une petite paupiette avec.( Lino Ventura)

  10. #9
    Yoruk

    Re : [Projet]Arduino et EMIC 2

    Yep c'est ce que je pense. Sinon il teste le code ascii brut il me semble, si on place une simple valeur numérique. Et à tester le contenu du buffer comme ça, il y a risque de se prendre aussi les caractères de retour à la ligne.
    La robotique, c'est fantastique !

  11. #10
    MajProblem

    Re : [Projet]Arduino et EMIC 2

    Bonjour , bonsoir

    J'ai enfin réussi a faire marche mon programme grace a vos conseils, voila le code :

    Code:
    #include <SoftwareSerial.h>
    #define rxPin 2    // Serial input (connects to Emic 2 SOUT)
    #define txPin 3    // Serial output (connects to Emic 2 SIN)
    // set up a new serial port
    SoftwareSerial emicSerial =  SoftwareSerial(rxPin, txPin);
    void setup()  // Set up code called once on start-up
    {
    // define pin modes
     
    pinMode(rxPin, INPUT);
    pinMode(txPin, OUTPUT);
    // set the data rate for the SoftwareSerial port
    emicSerial.begin(9600);
      Serial.begin(9600);
    
    emicSerial.print('\n');             // Send a CR in case the system is up
    while (emicSerial.read() != ':');   // When the Emic 2 has initialized and is ready, it will send a single ':'     character, so wait here until we receive it
    delay(10);                          // Short delay
    emicSerial.flush();                 // Flush the receive buffer
    }
    void loop() {
    if (Serial.available() > 0) {
    int inByte = Serial.read();
    
    switch (inByte) {
    case '1':
    emicSerial.print('S');
    emicSerial.print("Continuey tou droi");
    emicSerial.print('\n');
    while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
    break;
    
    case '2':
    emicSerial.print('S');
    emicSerial.print("toohrney aa drrwat");
    emicSerial.print('\n');  
    while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
    break;
    
    case '3':
    emicSerial.print('S');
    emicSerial.print("toohrney aa goshe");
    emicSerial.print('\n');
    while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
    break;
    
    case '4':
    emicSerial.print('S');
    emicSerial.print("fate demi tour avec prudanss");
    emicSerial.print('\n');
    while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
    break;
     
     }
    }
    }
    Merci pour votre aide !

  12. #11
    Yoruk

    Re : [Projet]Arduino et EMIC 2

    Citation Envoyé par MajProblem Voir le message
    toohrney aa drrwat
    fate demi tour avec prudanss
    ça doit être marrant un GPS avec la voix de Jane Birkin
    La robotique, c'est fantastique !

  13. #12
    luc_1049

    Re : [Projet]Arduino et EMIC 2

    bonjour

    Pas de default dans le switch pour gérer un cas d'erreur !
    Sauf si c'est un logiciel export, commentez en français.

    cdlt

Discussions similaires

  1. Projet ARDUINO
    Par IB69 dans le forum Électronique
    Réponses: 6
    Dernier message: 03/02/2014, 20h59
  2. Projet de bac Arduino
    Par kocliko dans le forum TPE / TIPE et autres travaux
    Réponses: 0
    Dernier message: 19/03/2013, 08h52
  3. projet communication pc-arduino
    Par invitedef4fb0d dans le forum Électronique
    Réponses: 3
    Dernier message: 21/02/2013, 12h10
  4. Projet arduino
    Par ouess dans le forum Électronique
    Réponses: 0
    Dernier message: 26/11/2012, 16h52
  5. Projet arduino
    Par invite6b4f2e28 dans le forum Électronique
    Réponses: 6
    Dernier message: 16/09/2012, 22h53
Découvrez nos comparatifs produits sur l'informatique et les technologies.